Find paragraph nodes start and end offsets


#1

Hello

Really enjoying ProseMirror.

However, We are having issues finding our paragraph offsets. In our schema, we have a ParagraphNode type that can contain EntityNode types.

When we use doc.resolve(pos).parent it resolves to an EntityNode. This is great but… is there a way of finding the EntityNodes parent (i.e: The ParagraphNode).

We need the ParagraphNodes start and end offset.

Apologies if this is a stupid question.

Best John


#2

You can access further ancestors of a given resolved position with .node(depth). See the docs. Does that help?