From ceae18f4cb505a54eb624a1a14d889ecaa7f6d98 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Tue, 4 Aug 2026 10:17:09 +0200 Subject: [PATCH] fix #797 - clear destroy handler in undomanager --- src/utils/UndoManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/UndoManager.js b/src/utils/UndoManager.js index 27af08ca..9d4634ae 100644 --- a/src/utils/UndoManager.js +++ b/src/utils/UndoManager.js @@ -253,10 +253,9 @@ export class UndoManager extends ObservableV2 { this.emit('stack-item-updated', changeEvent) } } + this.destroy = this.destroy.bind(this) this.doc.on('afterTransaction', this.afterTransactionHandler) - this.doc.on('destroy', () => { - this.destroy() - }) + this.doc.on('destroy', this.destroy) } /** @@ -383,6 +382,7 @@ export class UndoManager extends ObservableV2 { destroy () { this.trackedOrigins.delete(this) this.doc.off('afterTransaction', this.afterTransactionHandler) + this.doc.off('destroy', this.destroy) super.destroy() } }