Description
Describe the bug
Perhaps this is not really a bug.
when we copy something like this
- 1
- | 2
- 3 |
-> paste here
"|" means the cursor positon
Paste it in the "top-level" place, then nothing happens, but if you paste it into a nested place like 2-level or deeper, it's fine.
The general rule here seems to be that, let's define selection = [start, end]
, when the start_depth > end_depth
(like in the first example, "2"'s depth is 2 while "3"'s depth is 1), then you can only have the expected behavior when the paste_cursor_depth >= start_depth.
This issue can be simply reproduced in the BlockNote playground

after pasted, nothing happen

more example, copy these content and paste it also won't work

I think this makes sense to some extent. When you paste this content, if the "2" is supposed to be at the top level (which we define as depth = 1), then the "3" would need to be at level 0 (or event -1 / -2 ... when there are more nested structures), which is impossible.
I think maybe one of the better behaviors is that we adjust the nest structure to make it able to adapt to the target position. For example, in the first case, we could adjust and paste it as flattened content if it violates the rule (paste_cursor_depth
should >= start_depth
).
- 2
- 3
To Reproduce
This issue can be simply reproduced in the BlockNote playground.
Misc
- Node version:
- Package manager: latest
- Browser: chrome
- I'm a sponsor and would appreciate if you could look into this sooner than later 💖