Is there a way to prevent delete block on backspace? #1906
Replies: 5 comments 1 reply
-
How did you solve it,i have same problem |
Beta Was this translation helpful? Give feedback.
-
Hi @CavalcanteLeo, can you show me the full of sourcecode? I'm a newbie, i cant find where i can put your code |
Beta Was this translation helpful? Give feedback.
-
Any way to solve this issue? |
Beta Was this translation helpful? Give feedback.
-
Any way to solve this issue? |
Beta Was this translation helpful? Give feedback.
-
I have a hacky workaround that solved the problem for me. Context: A custom plugin made with react, a simple gallery of pictures, created with one wrapper div, an input to upload, and a dynamically added set of image tags to show the pictures. The problem is similar, I need to prevent someone from accidentally removing a gallery full of pictures by pressing the backspace, like to the behavior of the native "imageTool". The backspace event only removes blocks that are empty checking the property isEmpty. But the getter "isEmpty" does not consider nested input or images: editor.js/src/components/block/index.ts Line 411 in 6c0555a TLDR: As a workaround, I put a |
Beta Was this translation helpful? Give feedback.
-
Hi, i'm creating a platform for radiologists that makes structures reports.
So, users can not remove any block.
But when i press backspace, it deletes the whole block. Is there a way to prevent it? Also i can not allow to delete multiple blocks by selecting them
Users are still allow to delete letters/words from the block, but not the block itself
Beta Was this translation helpful? Give feedback.
All reactions