mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 10:50:23 +02:00
Avoid removing listeners that don't exist
This commit is contained in:
parent
3d79768549
commit
4c42ccdb3a
|
@ -748,8 +748,15 @@ export default class Block extends EventsDispatcher<BlockEvents> {
|
|||
* Is fired when Block will be unselected
|
||||
*/
|
||||
public willUnselect(): void {
|
||||
this.mutationObserver?.disconnect();
|
||||
this.removeInputEvents();
|
||||
/**
|
||||
* There's no need to disconnect the observer or
|
||||
* remove listeners if shouldUpdateOnMutation is false,
|
||||
* since they weren't set up in the first place.
|
||||
*/
|
||||
if (this.tool.shouldUpdateOnMutation) {
|
||||
this.mutationObserver.disconnect();
|
||||
this.removeInputEvents();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue