d4rkr00t / prosemirror-dev-tools

Developer Tools for ProseMirror
317 stars 37 forks source link

Text node start positions off by 1? #99

Closed taktran closed 1 year ago

taktran commented 4 years ago

Hi,

It seems like the text node start position is supposed to be 1 more than it is.

Screenshot 2019-10-18 at 9 46 16 am

In the above image, I think text should start at 20 instead of 19.

From the code, blocks increment by 1 for startPos

https://github.com/d4rkr00t/prosemirror-dev-tools/blob/c2d0ff4f1d9b66110d876340aa9def76cd096685/src/tabs/structure.js#L96

but text blocks don't ie,

https://github.com/d4rkr00t/prosemirror-dev-tools/blob/c2d0ff4f1d9b66110d876340aa9def76cd096685/src/tabs/structure.js#L116

Here is an example of a document in action where the paragraph is position 0 and the text inside is position 1:

https://runkit.com/taktran/prosemirror-nodesbetween

Is there a reason for this? I might be missing something, as I'm quite new to prosemirror :)

jonathonherbert commented 1 year ago

This matches my understanding, also – we've just been caught by this when debugging a piece of functionality w/ prosemirror-devtools.

(Lovely tool, btw. So useful for us at https://github.com/guardian, esp. when onboarding new developers.)