mirror of
https://github.com/yjs/yjs.git
synced 2026-08-29 10:09:05 +02:00
fix #797 - clear destroy handler in undomanager
This commit is contained in:
@@ -253,10 +253,9 @@ export class UndoManager extends ObservableV2 {
|
|||||||
this.emit('stack-item-updated', changeEvent)
|
this.emit('stack-item-updated', changeEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.destroy = this.destroy.bind(this)
|
||||||
this.doc.on('afterTransaction', this.afterTransactionHandler)
|
this.doc.on('afterTransaction', this.afterTransactionHandler)
|
||||||
this.doc.on('destroy', () => {
|
this.doc.on('destroy', this.destroy)
|
||||||
this.destroy()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -383,6 +382,7 @@ export class UndoManager extends ObservableV2 {
|
|||||||
destroy () {
|
destroy () {
|
||||||
this.trackedOrigins.delete(this)
|
this.trackedOrigins.delete(this)
|
||||||
this.doc.off('afterTransaction', this.afterTransactionHandler)
|
this.doc.off('afterTransaction', this.afterTransactionHandler)
|
||||||
|
this.doc.off('destroy', this.destroy)
|
||||||
super.destroy()
|
super.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user