Skip to content

Multi-block drag to column drop only moves the first block #2534

@Noyce-Joel

Description

@Noyce-Joel

What’s broken?

When selecting multiple blocks and dragging them into an adjacent column, only the first of the selected blocks is placed into the column and the remaining blocks are seemingly left behind.

What did you expect to happen?

I'd expect all blocks in the selection to be included in the slice.content() and not just the first child.

Currently if I have blockA, blockB and blockC and I select blockA and blockB together; then drag that selection to the left or right edge of blockC and release, I'd expect all selected blocks to appear in the new column.

Steps to reproduce

https://www.blocknotejs.org/examples/basic/multi-column

Highlight all blocks in the far right column in this example then drag the selected blocks to another column. Only the first block is relocated to the other column. The others are left behind.

BlockNote version

0.37.0

Environment

Chrome 145.0.7632.117

Additional context

Looking at MultiColumnDropCursorPlugin.ts the handleDrop extracts only the first node from the drag slice:

const draggedBlock = nodeToBlock(
slice.content.child(0),
editor.pmSchema,
);

Could we not iterate over all slice.content() children and create an array of selected blocks to be passed through the code?

Contribution

  • I'd be interested in contributing a fix for this issue

Sponsor

  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue has not yet been reviewed or classified by maintainers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions