How to avoid deleting a list item if it will be the last item in the list? #5739
Replies: 2 comments 1 reply
-
|
Using https://prosemirror.net/docs/ref/#state.PluginSpec.appendTransaction |
Beta Was this translation helpful? Give feedback.
-
|
You should set the parent ParentNode.extend({
content: "bullet_list other_not_required_node*"
})notice you should use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone 👋
I have an app that has several blocks and one of these blocks is a list type. The list type can only contain list items inside it. I'm trying to check if when
Backspaceis pressed the list will be empty and deleting such block.The pseudo-code that I'm looking for is:
Backspacewas pressedI was able to do such thing using extension's
addKeyboardShortcuts:The problem is that the user can
CTRL+Aand then pressBackspace, deleting everything. How can I detect this situation and ALWAYS leave at least one list item?Beta Was this translation helpful? Give feedback.
All reactions