Suppose I have HTML DOM like this(ignore the outter doc container):
besides, for purpose of debug, I set
window.selection = state.selection in editor view’s
then, i put cursor into the position after 2 and before 3.
after all these things done, i try to print the result of
selection.$from.start(4) and it return 4. But when i print
selection.$from.end(4), I got an error.
That confused me. In fact i think, the $from’s depth is 3, when start(3) invoked, $from is in a TextNode( it’s 12345), so it return the TextNode start position before 1 and after
<p>, so it be 3, it’s OK. And besides, end(3) return position in TextNode’s end, so it’s after 5 and before
</p>, it’s 8, That’s OK, too. but start(4) should got an error, just like end(4).
Or I got some misunderstand about the ResolvedPos.start API?
thank in advance!