How can I get the position of a node that’s inserted using
Transaction.replaceSelectionWith()? That is, given something like this:
const node = . . . ; const tr = view.state.tr.replaceSelectionWith(node); assert(tr.doc.nodeAt(???) === node);
how can I know what
??? is? I’ve tried things like
tr.selection.from on the idea that I had just replaced the selection, but I can’t find a pattern to the relationship between
tr.selection.from and where he inserted node actually goes in the document.
So is there a correct way to know the inserted node’s position? Do I need to perhaps examine the steps in the transaction?