https://codesandbox.io/ is a great alternative to glitch, does that work in your country ?
And if you replace the content of mytag from text* to paragraph, the issue disappears.
I had the exact same issue in this example for my library and changing the text* to paragraph fixed it.
I narrowed the problem to the ignoreMutation
handler of the nodeView. From what I understand, this handler tells Prosemirror to handle the mutation event which itself creates an empty text node in response to the mutation event.
Here is my ignoreMutation
handler, pay attention to if (mutation.target === this.contentDOM) {
clause:
ignoreMutation(mutation) {
// For PM an atom node is a black box, what happens inside it are of no concern to PM
// and should be ignored.
if (this._node.type.isAtom) {
return true;
}
// donot ignore a selection type mutation
if (mutation.type === 'selection') {
return false;
}
// if a child of this.dom (the one handled by PM)
// has any mutation, do not ignore it
if (this.dom.contains(mutation.target)) {
return false;
}
// <!---THIS CONDITION FIXES THE PROBLEM -->
// if the this.dom itself was the target
// do not ignore it. This is important for schema where
// content: 'inline*' and you end up deleting all the content with backspace
// PM needs to step in and create an empty node for us.
if (mutation.target === this.contentDOM) {
return false;
}
return true;
}
you can see full code here