Skip to content

Commit cdac5db

Browse files
committed
fix(readonly): prevent warning on initial read-only mode toggle
1 parent a04c37b commit cdac5db

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@editorjs/editorjs",
3-
"version": "2.31.0",
3+
"version": "2.31.1",
44
"description": "Editor.js — open source block-style WYSIWYG editor with JSON output",
55
"main": "dist/editorjs.umd.js",
66
"module": "dist/editorjs.mjs",

src/components/modules/readonly.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ export default class ReadOnly extends Module {
7171

7272
this.readOnlyEnabled = state;
7373

74+
/**
75+
* Do not render UI if state is read-only and it's initial call
76+
*/
77+
if (this.readOnlyEnabled && isInitial) {
78+
return this.readOnlyEnabled;
79+
}
80+
7481
for (const name in this.Editor) {
7582
/**
7683
* Verify module has method `toggleReadOnly` method

0 commit comments

Comments
 (0)