Hey! First off - thanks for maintaining Prosemirror and helping us out over here Marijn! I’m Dominik, one of the maintainers over at Tiptap. I’m currently trying to improve the list behaviour of our listItem extension so it works similar to other editors (some users where pretty confused on how list items are joined/lifted on backspace or delete.
I already fixed some of the backspace / delete behaviors and edgecases I ran into - but I really struggle with finding positions inside nested elements. I feel confident while I’m not working in nested elements, but as soon as nesting comes in I feel super lost.
Lets say I have a
$bulletListPos which is a
ResolvedPos of a bulletList node - and this list contains nested lists too and I want to add / move / cut content into the last listItem node found in the bulletList - what would be the best way to find this position?
Since the last item can be deeply nested, I can’t just find it by using
$bulletListPos.end() - 1 because this will point into the nested bulletList, right?
Should I go via descendents here? Or is there any easier way I didn’t grasp yet? I’m still quite new to Prosemirror and I tried to get a grasp on everything via the Docs and looking at existing code but finding positions is still a big issue for me.
Thanks already for your support take your time.