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
I'm using an (old) example from the docs to highlight blocks spanned by the current selection. The highlighting works just fine, but this seems to break the editor's undo/redo functionality.
Press ctrl + z or cmd + z to undo what you typed. It will take multiple attempts to undo just one character.
Remove the onSelectionChange prop from <BlockNoteView />
Type something again in the editor
Now the undo should work just fine.
It looks like the editor.updateBlock() calls within the editor.forEachBlock() causes the editor's history to break. Is there an alternate way to update the style of blocks?
Misc
Node version: 20.11.1
Package manager: npm
Browser: Firefox 126.0.1, Google Chrome 125.0.6422.142
The text was updated successfully, but these errors were encountered:
matthewlipski
changed the title
Updating a block's style with editor.updateBlock() breaks the editor's undo/redo functionality
Calling editor.updateBlock() in quick succession breaks the editor's undo/redo functionality
Jun 11, 2024
Good catch! You're right, it does seem like calling updateBlock many times in a short time causes history to break. Seems like we should make it possible to update multiple blocks at once to prevent this.
Describe the bug
I'm using an (old) example from the docs to highlight blocks spanned by the current selection. The highlighting works just fine, but this seems to break the editor's undo/redo functionality.
To Reproduce
The demo is here.
To reproduce the issue, please do the following:
ctrl + z
orcmd + z
to undo what you typed. It will take multiple attempts to undo just one character.onSelectionChange
prop from<BlockNoteView />
It looks like the
editor.updateBlock()
calls within theeditor.forEachBlock()
causes the editor's history to break. Is there an alternate way to update the style of blocks?Misc
The text was updated successfully, but these errors were encountered: