I am trying to join 2 ProseMirror docs, one of which is focused and contains a cursor:
<doc-1> Hello… </doc-1>
<doc-2> Ther<CURSOR>e… </doc-2>
(we can assume that we already know which doc is focused)
I would like to append doc-2 to doc-1, and have the cursor remain exactly where it is. Is there a straightforward way to think about doing this? I haven’t yet wrapped my head around all the different kinds of selections and positions.
I’ve tried reading the cursor’s coordinates on the screen, and then mapping that back to the newly-joined doc, but was getting inconsistent results, and this also wouldn’t work if the two docs were not exactly next to each other. I would rather have some way of using the offset/position precisely, just not sure how to do that when joining two documents.