Given a document Pos(ition) how can I find the DOM node path?
What do you want to do with the DOM node? Changing them is unlikely to work.
Found DOMFromPos in edit/dompos.js .
I am trying to track the actual pixel location of the markRange from/to position, seems when I try to use the document “transform” event to do this, strange things happen, the positions gets shifted, maybe the positions have not yet settled? Perhaps I need to throttle the event handler.
Which event should I listen to properly tracking markRange Positions? Maybe the markRange should signal a transform?
You can use the
coordsAtPos method to find the screen coordinates at a position. But display updates are asynchronous, so you should probably wait for a
draw event – when
transform fires, the changes haven’t been flushed to the display yet.
The draw event mostly works, but should markRange fire some sort of movement/ change signal, since it’s the only way for external programs to track positions?
You should reposition after every
"draw" event, since even if the position towards a range stays the same, the content above it might have changed size so its pixel position isn’t guaranteed to be the same.