I’m building a plugin which I’d like to replace certain strings such as {custom-tag} with a DOM element in the editor.
I’ve done this in CodeMirror 6 using the replace decoration and PluginField.atomicRanges
, which perfectly covers my usecase.
In ProseMirror, I’m attempting this with a combination of:
- A widget decoration which displays my DOM element and will have click handlers
- An inline inline decoration which hides the {custom-tag} itself
When part of the {custom-tag} is deleted, the widget and the inline decorations are disappearing fine. But I’m struggling to find the right way to remove the rest of the tag. e.g. when the closing } is deleted, I want the rest of the {custom-tag to be removed also.
What would be the best way to achieve this? And any plans to introduce a Replace-style decoration to Prosemirror?
Thanks again!