contentDOM is what holds the lines, isn’t it? So with relation to it’s bounding rect I would always get the first line. I tried and it appears to be the case: regardless of the scroll position, I always get the first line.
Other options I tried is dom and scrollDOM. These two give me the topmost visible line. Which one is better to use?
And with regards of the documentation I wonder if it needs to be updated again or if I have done something not quite right again.
Recap:
I want the number of the topmost visible line in the editor. This code gives me it:
editor.state.doc.lineAt(
editor.visualLineAtHeight(
editor.scrollDOM.getBoundingClientRect().top
).from
).number