Inconsistent behavior with Selection and "atom" Node

My app has a line with text where I can add text inputs (they are wrapped in webcomponents and set as “atom” Nodes, unselectable and “isolating”.

They work as expected except if there is no content right after the node, in this case the text inputs get removed upon pressing backspace while writing inside it. If there is some text right after the node it does not happen.

I was investigating a bit and notice that that if “editorView.state.selection.from” matches the index right after my text input node it gets removed upon pressing backspace, if it is another value (because I entered text after adding the node, or clicked somewhere else before focusing on the text input field) it doesn’t get removed and the backspace seems to be completely ignored (I would expect it to remove whatever is at selection index).

Are there any settings that I am supposed to use in this case? Or should I write some code to handle transactions differently whenever the text input webcomponent has focus?

You mention editing inside the nodes. Is that done in another control (which is separately focused), or is that still ProseMirror managing the editing, via a contentDOM on the node view?

Hi @marijn, I set these properties to my component’s nodeSpec

    atom: true,
    isolating: true,
    inline: true,
    selectable: false,

I was expecting ProseMirror to ignore any inputs while the focus is on my component, and it seems to be the case. Apparently the only exception is if the selection points to the index right after the component and I press backspace, which removes the node holding my component. I’m not using ProseMirror inside my component, it’s an implementation of Google Material text input.

I’m not using contentDom.

If focus is on your node view, you can use the stopEvent method on your node view object to prevent ProseMirror from handling events inside it.

The removal is happening at this line.

Hi @marijn, your stopEvent() suggestion worked for me.

Thanks for your time!