How to delete the whole dom generated by replace decorator as v5 markText

I write a viewPlugin which replace content with custom dom. When press Backspace,I want to delete the whole replaced dom. When I use markText of codemirror5,it meets expectation,but when use codemirror6,it just delete single string。What I can do?

You may be looking for atomicRanges.

Thanks very much

do you have a demo ?

I implete like this obsidian-icon-shortcodes/view-plugin.ts at 857673087c729d19d186c889c9895eb144b440a8 · aidenlx/obsidian-icon-shortcodes · GitHub

Your function is based on EventHandle,
I want to set up highlights in the range, and then I can turn off the highlights