I’m trying to deduce if the current selection is within a specific node. To do that I first calculate the nodeRange using the following code:
const nodeRange = state.selection.$from.blockRange( state.selection.$to, );
Now, If I console.log this I can see a
path field, which I can access with:
$from in the above case if of class
ResolvedPos (https://prosemirror.net/docs/ref/#model.ResolvedPos). But in the documentation the
path field is not present (nor in the typescript declarations).
So, is this even a reliable field to use or we should avoid it? It could definitely help me with my initial objective to see if the current selection falls within a single node (e.g. a bulleted list). Also, is there a more easy/elegant way to achieve this?