diff --git a/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts b/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts index 1eccbb64d..5cb083ec6 100644 --- a/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts +++ b/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts @@ -46,8 +46,6 @@ export class AffineDragHandleWidget extends WidgetComponent { private readonly _reset = () => { this.dragging = false; - this.dragHoverRect = null; - this.anchorBlockId.value = null; this.isDragHandleHovered = false; this.pointerEventWatcher.reset(); @@ -105,6 +103,9 @@ export class AffineDragHandleWidget extends WidgetComponent { ); }; + /** + * @param force Reset the dragging state + */ hide = (force = false) => { if (this.dragging && !force) return; updateDragHandleClassName(); @@ -112,6 +113,7 @@ export class AffineDragHandleWidget extends WidgetComponent { this.isDragHandleHovered = false; this.anchorBlockId.value = null; + this.dragHoverRect = null; this.activeDragHandle = null; if (this.dragHandleContainer) { @@ -179,7 +181,6 @@ export class AffineDragHandleWidget extends WidgetComponent { this._disposables.addFromEvent(this.host, 'pointerleave', () => { this.hide(); }); - this._handleEventWatcher.watch(); if (isInsidePageEditor(this.host)) {