You could make the label text an attribute, rather than content. That would prevent ProseMirror from trying to manage it.
But when you select across a node and press delete, the selected range is going to be deleted—whether individual nodes in the range are editable isn’t relevant there. The only way to prevent that is to filter transactions.
By filter transations, do you mean the filterTransaction and appendTransaction in PluginSpec?
So when the current transaction is a selection-deleting/replacing action and the selection contains the node I want to preserve (I don’t know how to implement this judgement), I append a new transaction to restore the node, am I right?
BTW, would it be possible to support defining a NodeSpec that is non-deletable?
I think it is quite common. If this is supported, I would define such nodes like title, author and etc. and put them in the editor to take full advantage of prosemirror’s function, instead of simple input or textarea elements outside of the editor.
When the user select all the document and hit delete, they would not be deleted (the element tag in the editor is preserved, while the content may be removed), since they are essential to a document.