1

I am adding html block in tinymce on clicking of button

<span class='remove-block'>Kenny <span class='remove-block'>Symonds</span></span>

So far so good, tinymce adds this html block properly in editor. Now what I want is when user presses backspace tinymce should check whether there is remove-block span element at cursor point, if yes then remove whole block. I know I have to do it on keyup like

setup: editor => {
     editor.on('keyup', (event) => {
          if (event.keyCode === 8) {
               // backspace pressed
          }
     })
}

Any help would be appreciated.

Kiran Shinde
  • 5,732
  • 4
  • 24
  • 41
  • 1
    Do you want the content within the block to be editable? If not, you can use the noneditable plugin. Noneditable content blocks are treated like single characters in the editor, and so the entire thing would be delete upon backspace/delete: https://www.tiny.cloud/docs/plugins/opensource/noneditable/ – Tiny Lincoln May 21 '21 at 18:04
  • @TinyLincoln Awesome. Please add it as a answer. Will mark it. It just met my requirement – Kiran Shinde May 22 '21 at 05:37

0 Answers0