From 95e890d99ac6b8462fc02722e60b1dbd17c9c29d Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Tue, 4 Aug 2026 10:07:06 +0200 Subject: [PATCH] fix #797 - undomanager clears destroy handler --- 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 98410e4d..e5c4dc82 100644 --- a/src/utils/UndoManager.js +++ b/src/utils/UndoManager.js @@ -265,10 +265,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) } /** @@ -395,6 +394,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() } }