Skip to content

Commit c864e1a

Browse files
fix: dragging multiple blocks (#170)
* fix: dragging blocks with the same type and content * fix: dragging blocks after dropped outside the editor * Code style fix --------- Co-authored-by: Matthew Lipski <[email protected]>
1 parent c9513cd commit c864e1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/extensions/DraggableBlocks/DraggableBlocksPlugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ function dragStart(e: DragEvent, view: EditorView) {
208208
const { from, to } = blockPositionsFromSelection(selection, doc);
209209

210210
const draggedBlockInSelection = from <= pos && pos < to;
211-
const multipleBlocksSelected = !selection.$anchor
212-
.node()
213-
.eq(selection.$head.node());
211+
const multipleBlocksSelected =
212+
selection.$anchor.node() !== selection.$head.node() ||
213+
selection instanceof MultipleNodeSelection;
214214

215215
if (draggedBlockInSelection && multipleBlocksSelected) {
216216
view.dispatch(

0 commit comments

Comments
 (0)