Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(editor): should remove drag preview after drop (#9313)

Saul-Mironea595a145f0e3
diff --git a/blocksuite/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts b/blocksuite/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts
index 128b1f8cdc..0923efe2ce 100644
--- a/blocksuite/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts
+++ b/blocksuite/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts
@@ -72,9 +72,15 @@ export class DragEventWatcher {
}
};
- private readonly _dragEndHandler: UIEventHandler = () => {
+ private readonly _cleanup = () => {
+ this.widget.previewHelper.removeDragPreview();
this.widget.clearRaf();
this.widget.hide(true);
+ this._std.selection.setGroup('gfx', []);
+ };
+
+ private readonly _dragEndHandler: UIEventHandler = () => {
+ this._cleanup();
};
private readonly _dragMoveHandler: UIEventHandler = ctx => {
@@ -118,9 +124,7 @@ export class DragEventWatcher {
return;
}
this._onDrop(context);
- this._std.selection.setGroup('gfx', []);
- this.widget.clearRaf();
- this.widget.hide(true);
+ this._cleanup();
};
private readonly _onDragMove = (state: DndEventState) => {