I’m seeing some behavior I don’t understand within prosemirror. Any help is appreciated.
I have code that inserts a nodeview and empty space before a word when a new character to start a new word is typed. See screen recording below.
The code works except when the user starts typing on an empty new line. In this case, the caret gets put in front of the most recently typed character and I can’t move the caret past the character unless I type another character.
- Move caret to an empty line
- Type a single character
- A node view and text node containing a space is inserted before the typed character
- Caret is before the character in step 2 and can’t move to the end of the character in step 2
- Type any character, the character is inserted and everything is back to normal
I’m inserting the nodeview and space at the same position using sequential insert commands:
tr = tr.insert( pos, state.schema.text(' ') ) tr = tr.insert( pos, node )
Screen grab of the issue showing two behaviors:
- Type a character, wait for nodeview + space insert, type another character
- Type a character, wait for nodeview + space insert, move back one position, move forward one position, type another character: