Allow text selection in leaf NodeViews

Is there a way to enable text selection inside leaf nodeview? Currently it seems that PM tries to “capture” the selection and map it inside the PM document. I would’ve imagined that if a node isnt draggable or selectable text selection inside the corresponding ndoe nodeview should be possible. The only workaround I found was making the content that should be selectable contenteditable, but thats not really ideal.

Heres and example that shows the problem: Glitch :・゚✧

Any help would be greatly appreciated!

By default, the editor treats all events in the editor as ‘belonging’ to the editor, and will handle them just like it handles events in all the rest of the editable content. You can tweak this with the stopEvent method on your node view—when that returns true for a certain event, the editor itself will ignore it. But getting separate selection to work inside a node is a bit more involved, since to the editor that looks exactly like in-editor selection, and it’ll try to sync the DOM selection with its selection state. As you found, when the element is focusable through contenteditable=true, that shows ProseMirror that it doesn’t ‘own’ the selection, and will cause it leave it alone. You can make something focusable without making it editable by giving it a tabindex=-1 attribute.

Yeah, that was my first approach and it failed miserably :wink:

Yes, thats exactly what I was looking for. Thank you so much!