I’m trying to find out which position is currently visible in the middle of the screen.
Wanted to use EditorView.posAtCoords to achieve this. However, I constantly get
RangeError: Trying to find position for a DOM position outside of the document
So I tried to find out what valid coords looke like by using EditorView.coordsAtPos:
let coords = view.coordsAtPos(1249) // 1249 is a valid position inside the current view port
// coords includes a valid set of coordinates and does not throw an error
let pos = view.posAtCoords({
x: coords.left,
y: coords.top,
})
Even this throws the error above. How is this possible? Am I missing something?