mirror of
https://github.com/codex-team/editor.js
synced 2026-03-14 22:55:47 +01:00
fix(blockSettings): prevent warning on initial read-only mode toggle (#2969)
Co-authored-by: Peter <specc.dev@gmail.com>
This commit is contained in:
parent
fb2bf8f116
commit
90d6dec90e
3 changed files with 16 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
@ -92,6 +97,7 @@ export default class BlockSettings extends Module<BlockSettingsNodes> {
|
|||
}
|
||||
|
||||
this.eventsDispatcher.on(EditorMobileLayoutToggled, this.close);
|
||||
this.hasMobileLayoutToggleListener = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue