Resolved: Selection moved into position that doesn't allow editing when <>•<p></p></>

Context: At Storyscript, we’re using ProseMirror to edit “structured code”. So, in this example, we will have three kinds of nodes with content:

  • hole: "text*"
  • token: atom
  • mention: atom
  • codeLine: "(token|mention)* hole"

Unfortunately, I’m getting into this stuck place when my cursor is inside a hole, and I backspace to delete a token, my cursor gets moved from <codeLine><token/><hole>•</hole></codeLine> to <codeLine>•<hole></hole></codeLine> which stops me from being able to add text inside the hole.

I recorded the following video showing a few places where I’m seeing strange behaviors.

At 8s, I hit backspace and it moves my cursor to the beginning of the line as opposed to inside the empty hole.

At 12s, I hit backspace to delete the preceding “token” but my cursor is moved out of the hole so I lose my ability to continue typing.

Screen Recording 2020-05-07 at 11.54.17 AM_1

Here’s a better quality mirror of the recording

Sorry, I think I’ve resolved this issue by disabling a plugin causing weirdness at 8s and using the following content expression for my codeLine: "(token|mention)+ hole | text*"