I have an editor like this
The operation I did is drag the h1 node to the second line, i.e. I want h1 to be the second line.
I’ve logged some pos info:
dragging node pos 1
drop on block node pos 18 node type paragraph
But I may be lack of some knowledge to implement it …
To provide more information for getting helped…
How do I get the "dragging node pos" ?
I use posAtDOM to get the h1’s pos
How do I get the "drop on block node pos" ?
I use prosemirror-utils method findParentNodeClosestToPos
findParentNodeClosestToPos need two params:
- a ResolvedPos
- a predicate function
- For param 1: I saved a
posfrom the last hovered HTMLElement when dropping, usedposAtCoords, the coords is from my mouse position. - For param 2: it is
node => node.isBlock, which is quite simple
