Please have a look at gallant-sun-2kd4zq - CodeSandbox, which uses Tiptap.
On each line, go to the end of the line, then keep deleting.
- Line 1: Characters are deleted one by one, which is correct
- Line 2: “Ext2” (the atom node) is deleted in one go, other characters are deleted one by one, which is also correct.
- Line 3: “Ext2” is still deleted in one go (correct), but “Ext1” is also deleted in one go (not correct).
I was directed from Tiptap to here because this is apparently a ProseMirror bug. Quoting a Tiptap contributor:
In cases like
Ext1Ext2
where two nodes are directly adjacent, deletingExt2
causes the editor’s selection to be placed after theExt1
node. Pressing Backspace then removes the entireExt1
node.In contrast, when
Ext1
is followed by any text node, deleting the text node places the editor’s selection at the end ofExt1
node’s internal content. Pressing Backspace in this case deletes the text withinExt1
.
I’m very sorry for not being able to present a reproduction not using Tiptap, as I only know how to use Tiptap… But the description of the behaviour should hopefully give you an overview of what the bug is about.