- current selection is a NodeSelection on node at pos p
- i call setNodeMarkup at p (to change only an attribute) and dispatch that transform
- now current selection is a TextSelection
is this expected ? did i screw up again ?
is this expected ? did i screw up again ?
This is intended behavior — setNodeMarkup
modifies the targeted node, and node selections only ‘stick’ when the node they refer to stays intact.
In cases like this, that may seem like silly behavior, but it would be bad if a random document transformation that happened to replace the selected node with another node would automatically select that new node, since that doesn’t correspond to the actual thing the user had selected. So in cases like this, the recommended workaround is to reset the selection after you update the node’s markup.