BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

Cannot use two block node editors at the same time

Open bigabig opened this issue 1 year ago • 7 comments

Describe the bug In my react application, I have two completely different components that are both using BlockNote. Both components are visible at the same time under some circumstances. All features but one are working perfectly fine: Dragging & dropping blocks to re-arrange them.

If I drag and drop a block in one editor, this block is duplicated in the other editor!

My wild guess is, that both editors are listening to the same "drag-and-drop" event, and are both reacting to it accordingly.

To Reproduce

  1. render two BlockNote editors next to each other
  2. type some text in both editors (e.g. create 3 normal text blocks in each editor)
  3. drag and drop text in one editor, you will notice the dragged text also appears in the other editor

Misc

    "@blocknote/core": "^0.17.1",
    "@blocknote/mantine": "^0.17.1",
    "@blocknote/react": "^0.17.1",

bigabig avatar Oct 30 '24 10:10 bigabig

@YousefED - is there any upcoming fix for this?

jestelb avatar Dec 12 '24 11:12 jestelb

@YousefED I believe this issue is still happening on v0.23.1 (latest)

To Reproduce:

  1. Setup two editor instances
  2. Drag block and drop to any part of its editor.
  3. Other editor will have the other text content

StackBlitz demo: https://stackblitz.com/edit/github-trlbwcpl?file=App.tsx

cc: @jestelb

ahlrarqueza-500designs avatar Feb 04 '25 03:02 ahlrarqueza-500designs

I'm experiencing the same issue, having 2 different instances of BlockNote in my view and when I drag an element from one, it appears in the second instance

Blapi avatar Feb 26 '25 21:02 Blapi

@matthewlipski could you weigh in on this?

YousefED avatar Feb 27 '25 07:02 YousefED

Are you passing sideMenuDetection: "editor" to the editor options? That might be it, since multiple editors aren't supported with the default setting (sideMenuDetection: "viewport")

matthewlipski avatar Feb 28 '25 12:02 matthewlipski

If this doesn't work there's a release coming today which should fix any outstanding drag & drop issues, and will also add docs for the sideMenuDetection option.

matthewlipski avatar Feb 28 '25 12:02 matthewlipski

Are you passing sideMenuDetection: "editor" to the editor options? That might be it, since multiple editors aren't supported with the default setting (sideMenuDetection: "viewport")

I confirm this fixes the issue on my end :)

Thanks a lot @matthewlipski for this solution!! 🎊

Blapi avatar Feb 28 '25 12:02 Blapi

This should be fixed in the latest versions

nperez0111 avatar Sep 19 '25 13:09 nperez0111