Locked nodes

Hi all,

What is the status of the the locked nodes feature?

It was never implemented. The content expressions (in the schema) feature replaces it.

1 Like

Maybe I misunderstand the meaning of locked nodes. I want to make some some text nodes only editable / deletable after confirming via a prompt. (Use Case: a table of content represented as list, were creating a list item also triggers creation of a document and removing a list item would also trigger removal of the corresponding document).

My initial thought for making text nodes on-demand non-editable: just setting the contenteditable attribute to false and block any transform state updates on that node. How do schema content expressions help me to achieve that?

They don’t. For nodes like that, you are probably better off making them leaf nodes, and storing their content in an attibute, so that ProseMirror doesn’t consider their content editable to begin with.

Ok. But I do want those nodes to be editable. Let me better explain how: by clicking onto a little unlock icon overlay at the corner of the text nodes, I wanna turn them into editable nodes.

Is there problem I am not yet aware of, like cross browser compatibility of having contenteditable=false inside prosemirror?

ProseMirror does not (yet?) have a way to model for content that is sometimes editable. You can force contenteditable off in your render function, but that won’t prevent the editor from trying to move the selection into there, for example, or accepting changes when they are made in a way that doesn’t directly involve a cursor in the node, such as drag/drop.

You could try to filter out transform actions that touch the ranges you want to be non-editable (by iterating through their position mapping), but that might still leave the interface looking inconsistent sometimes (for example when it shows a drop target in a place you’re not supposed to be able to edit).

Ok, thanks a lot, now I am aware of the problems, many …