From 938e1fc4211a29034a1d8311b236bf5564b877ad Mon Sep 17 00:00:00 2001 From: pengx17 Date: Sun, 22 Dec 2024 11:03:13 +0000 Subject: [PATCH] fix(blocks): blocksuite drop should prevent default (#9037) --- .../widgets/drag-handle/watchers/drag-event-watcher.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts b/packages/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts index f1cb4fa96641..21315afef153 100644 --- a/packages/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts +++ b/packages/blocks/src/root-block/widgets/drag-handle/watchers/drag-event-watcher.ts @@ -241,6 +241,8 @@ export class DragEventWatcher { const state = context.get('dndState'); const event = state.raw; + event.preventDefault(); + const { clientX, clientY } = event; const point = new Point(clientX, clientY); const element = getClosestBlockComponentByPoint(point.clone()); @@ -265,7 +267,6 @@ export class DragEventWatcher { const index = parent.children.indexOf(model) + (result.type === 'before' ? 0 : 1); - event.preventDefault(); if (matchFlavours(parent, ['affine:note'])) { const snapshot = this._deserializeSnapshot(state);