Skip to content

Commit

Permalink
Fixed doc change detection
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Dec 27, 2024
1 parent 287d174 commit 343c7e0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions private/js/tiptap_plugins/cms.toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ function _createBlockToolbarPlugin(editor) {
})
]); },
apply(tr, value, oldState, newState) {
const selectionChanged =
tr.docChanged || oldState.selection.eq(newState.selection) === false;

if (selectionChanged) {
if (!oldState.doc.eq(newState.doc) || oldState.selection.eq(newState.selection) === false) {
updateBlockToolbar(editor, newState);
}
return value;
Expand Down Expand Up @@ -251,9 +248,7 @@ function _createTopToolbarPlugin(editor, filter) {
]);
},
apply(tr, value, oldState, newState) {
const selectionChanged = tr.docChanged || oldState.selection.eq(newState.selection) === false;

if (selectionChanged) {
if (!oldState.doc.eq(newState.doc) || oldState.selection.eq(newState.selection) === false) {
setTimeout(this.handleSelectionChange, 0);
}
return value;
Expand Down

0 comments on commit 343c7e0

Please sign in to comment.