Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 2.31.1

- `Fix` - Prevent the warning from appearing when `readOnly` mode is initially set to `true`

### 2.31.0

- `New` - Inline tools (those with `isReadOnlySupported` specified) can now be used in read-only mode
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.31.0",
"version": "2.31.1",
"description": "Editor.js — open source block-style WYSIWYG editor with JSON output",
"main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs",
Expand Down
12 changes: 11 additions & 1 deletion src/components/modules/toolbar/blockSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
return 'flipper' in this.popover ? this.popover?.flipper : undefined;
}

/**
* Flag that indicates whether the `EditorMobileLayoutToggled` event listener is attached.
*/
private hasMobileLayoutToggleListener = false;

/**
* Page selection utils
*/
Expand All @@ -92,6 +97,7 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
}

this.eventsDispatcher.on(EditorMobileLayoutToggled, this.close);
this.hasMobileLayoutToggleListener = true;
}

/**
Expand All @@ -100,7 +106,11 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
public destroy(): void {
this.removeAllNodes();
this.listeners.destroy();
this.eventsDispatcher.off(EditorMobileLayoutToggled, this.close);

if (this.hasMobileLayoutToggleListener) {
this.eventsDispatcher.off(EditorMobileLayoutToggled, this.close);
this.hasMobileLayoutToggleListener = false;
}
}

/**
Expand Down
Loading