diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7eff455e3..0a85fb772 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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 diff --git a/package.json b/package.json index 5039584f8..386aee8c4 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/modules/toolbar/blockSettings.ts b/src/components/modules/toolbar/blockSettings.ts index 88f861b40..2b1e40356 100644 --- a/src/components/modules/toolbar/blockSettings.ts +++ b/src/components/modules/toolbar/blockSettings.ts @@ -68,6 +68,11 @@ export default class BlockSettings extends Module { 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 */ @@ -92,6 +97,7 @@ export default class BlockSettings extends Module { } this.eventsDispatcher.on(EditorMobileLayoutToggled, this.close); + this.hasMobileLayoutToggleListener = true; } /** @@ -100,7 +106,11 @@ export default class BlockSettings extends Module { 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; + } } /**