Is there a way that I can keep track of a node so that I can come back and modify it later?
I am trying to implement a image drag and drop functionality. The idea is I would preview the image before the image is uploaded. Then when the image is uploaded, I would replace the src with the actual url.
I tried to use markRange but couldn’t figure out how it works.
I tried to highlight the text then do.
mr = pm.markRange(pm.selection.head, pm.selection.anchor) to mark the currently selected range.
But when I move the text, mr.from and mr.to becomes null.
if I set the option removeWhenEmpty to false,then it won’t be null but the from and to value became the same value.
What do you mean with ‘when I move the text’? If you insert content before or after it, the mark will move along with that. If you delete it, the mark will indeed be collapsed.