I know that there is a filterTransaction
method, where I can return false
on some conditions to decline transaction (for example if a selected area has a particular mark). But if a selection has some text, nodes and marks and the user deletes selection, then everything except the specific mark should be deleted. How can I do it?
That’s not really possible, except by handling individual actions that might cause the deletion (handleTextInput
, key bindings for delete/backspace/etc).
Key binding is not suitable because user can edit selection by many different methods, e.g. select and paste copied text from outside.
This question is similar to others:
- How can I disable the option to delete a custom node from prosesmirror?
- How to prevent node deletion?
- The content of non-editable node is still editable
- ProseMirror and Uneditable content in the document
- Whats an example of the minimal code required to undo a transformation?
This would be a quite handy feature to take control over transactions and to be able to allow/disallow action for each part (Node, TextNode, Mark, etc.) inside filterTransaction.