prosemirror-dev-tools icon indicating copy to clipboard operation
prosemirror-dev-tools copied to clipboard

Text node start positions off by 1?

Open taktran opened this issue 5 years ago • 1 comments

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 :)

taktran avatar Oct 18 '19 08:10 taktran

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.)

jonathonherbert avatar Sep 12 '22 12:09 jonathonherbert