Skip to content

Commit

Permalink
fix: updates can actually be emitted again
Browse files Browse the repository at this point in the history
  • Loading branch information
nperez0111 committed Jan 2, 2025
1 parent d6c7558 commit 0a976d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ export class Editor extends EventEmitter<EditorEvents> {
const { state, transactions } = this.state.applyTransaction(transaction)
const selectionHasChanged = !this.state.selection.eq(state.selection)
const rootTrWasApplied = transactions.includes(transaction)
const prevState = this.state

this.emit('beforeTransaction', {
editor: this,
Expand Down Expand Up @@ -513,7 +514,7 @@ export class Editor extends EventEmitter<EditorEvents> {
}

// Compare states for update event
if (transaction.getMeta('preventUpdate') || transactions.every(tr => !tr.docChanged) || this.state.doc.eq(state.doc)) {
if (transaction.getMeta('preventUpdate') || !transactions.some(tr => tr.docChanged) || prevState.doc.eq(state.doc)) {
return
}

Expand Down

0 comments on commit 0a976d8

Please sign in to comment.