I am using the html editor to edit the content. Now I need to make sure that a very special element is not deleted (images with a special class).
For cases of using an uncomplicated selection / range with BACKSPACE, DELETE, CTRL + X / CMD + X, I have found a solution, but I'm still looking for a solution for the case where the choice / range is not and the following Backspace will delete one of my special images.
How can I tell if the next Backspace / Delete will remove one of these img tags?
Example: CARET marks the position of the cursor / cursor. If Backspace is clicked, the image will be deleted. How can I detect this case?
<p>Some Text <b>here <img class="my class" src="..."/></b>CARET some text</p>
source
share