Is there a recommended way to get the left/top/width/height coordinates of a given range?
A naive approach would be to use coordsAtPos
on the $from
and $to
positions and use their bounds. This falls down in a multi-line situation where the $from
and/or $to
are not at the left-most or right-most outside bounds of the content.
Using domRange.getBoundingClientRect()
might work if I could translate a PM range to a DOM range, though I’m not sure how to do this.