Cannot use two block node editors at the same time
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
- render two BlockNote editors next to each other
- type some text in both editors (e.g. create 3 normal text blocks in each editor)
- 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",
@YousefED - is there any upcoming fix for this?
@YousefED I believe this issue is still happening on v0.23.1 (latest)
To Reproduce:
- Setup two editor instances
- Drag block and drop to any part of its editor.
- Other editor will have the other text content
StackBlitz demo: https://stackblitz.com/edit/github-trlbwcpl?file=App.tsx
cc: @jestelb
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
@matthewlipski could you weigh in on this?
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")
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.
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!! 🎊
This should be fixed in the latest versions