So as said, inline nodes work weirdly with many different keypress commands. Well, this is expected and Martin has mentioned that any custom inline functionality will require a lot of manual plumbing to make it work as intended.
Anyway, recently I found a very peculiar behavior which happens when backspacing inline nodes with text content. After inputting something in an inline node, then breaking out of it into regular text (all inside single paragraph), pressing backspace would cause all content in the paragraph before it to be deleted. As a matter of fact this would happen even if new text inside inline node would be inserted, the second character would prevent it. After that any backspacing would work as intended, only deleting a single character, moving in and out of inline nodes as it’s supposed to. But basically this behavior is like pressing Cmd+Backspace
in macOS, all content before the cursor is deleted to the start of the paragraph.
I tried to track down this misbehaving piece of code, but I think it would require me to add breakpoints to the prosemirror-view source code which I guess is doable but would take time. Easy way to fix this, which I guess is the only way, is to just reimplement the Backspace and be done with it, but I wanted to know if there was a good reason for this behavior? It’s just so odd.
Also similarly, I copied this as a test for my custom backspace behavior as in the prosemirror-view
state.tr.delete($cursor!.pos - 1, $cursor!.pos).scrollIntoView()
This has a sort of same problem, where as this time backspacing with cursor next to inline node would take one extra backspace to start deleting the content inside the inline node. Sometimes it would not delete anything at all unless the editor is specifically refocused.
Okey well now that I took a good look at the transactions happening, I guess the reason for the duplicate backspace is because the selection in every backspace is moved only by one, leaving it outside the inline node the first time, next time properly moving it inside its text content. What makes it weirder is that refocusing the editor to the same place will cause it to work properly.
Hopefully this wasn’t too confusing without example site, I can deploy it if it’s worth something. And I haven’t forgotten about the mark problem, which I mentioned last time posting here, but since it’s waay down in the todo list haven’t gotten around thinking about it more =). Cheers, and thank you for your time.