You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Cursor is placed in a strange position after changing a node type and undoing it.
To Reproduce
Steps to reproduce the behavior:
type some text in the first line.
type some text in the second line.
change the second line type to heading.
press ctrl+z.
the cursor is placed at the beginning of the second line.
press backspace.
the border of the first line turns to blue.
press backspace again.
the first line is deleted.
Expected behavior
After ctrl+z, the cursor should stay at the end of the second line. Even if the cursor is placed at the beginning of the line, backspace should not create the blue border.
After an undo, the stack-item-popped event seems to be triggered after the document has been restored, so binding.beforeTransactionSelection is only updated after the selection has already been restored.
As I understand the undo plugin, after a transaction prevSel is saved in the plugin state so it can be added to the meta of the undo stack item. However, if UnderManager merges the edits, won't prevSel refer to a wrong position? (edit: reading more about yjs, this does not seem to be a problem, but more generally, could prevSel refer to the wrong position?)
- introduce RecoverableSelection that wraps current selection and allows it to be restored later
- get ySyncPlugin state inside undoManager event hooks
fixesyjs#43, yjs#101, yjs#139
Describe the bug
Cursor is placed in a strange position after changing a node type and undoing it.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
After ctrl+z, the cursor should stay at the end of the second line. Even if the cursor is placed at the beginning of the line, backspace should not create the blue border.
Screenshots
https://user-images.githubusercontent.com/640041/160831412-2a79ee9d-0ad1-4790-844f-3357ac42e4d0.mp4
Environment Information
Chrome 98.0.4758.102 on the demo page.
Additional context
Testing in a local project, it seems the cursor is placed between nodes.
The text was updated successfully, but these errors were encountered: