I made a custom node that is basically a span with several custom attributes in the tag. I need to get the NodeSelection object from the selection (of $from and $to) so i could get the tag attributed at the beggining and the end of the selection. Tried to use Selection.near but is still returning me a TextSelection. The schema has the selectable: true defined.
Thanks for the suggestion, i tried it, but i still get a TextType at the node property of the NodeSelection with the attribute attrs empty. I tried also using tr.doc.nodeAt() with the same result. What i need is the same node object returned by HandleClickOn where the attrs property is filled with the values in the tag . Any other suggestion of how i could achieve this?
but i still get a TextType at the node property of the NodeSelection
That suggests that the position you’re using is not in fact pointing at the node you want. Possibly it’s pointing at the start of its content instead, and you need the position before it
Thanks for the comment, that made me use & adapt the function used by HandleClickOn to detect the node selectClickedNode Not sure if it’s the best solution but looks like it works.
Thanks again for the tips and the guide to the solution of the problem!