Skip to content

[Bug] v2.23.1 readOnly: true crashes the editor #1968

@hlynurstef

Description

@hlynurstef

On version 2.23.1 when we create a new EditorJs instance with readOnly: true the editor crashes with the following error:

Cannot read properties of undefined (reading 'destroy')

This crash does not happen on v2.23.0

Steps to reproduce:

  1. Make sure you are on version 2.23.1 of @editorjs/editorjs
  2. Create an EditorJs instance with readOnly: true
  3. Observe the crash

I've created a reproducable example in codesandbox where you can toggle between readOnly true/false:
https://codesandbox.io/s/editorjs-readonly-crash-myw3o?file=/src/App.js

When readOnly is toggled to true you can observe the crash.

NOTE: This crash does not happen on v2.23.0

Expected behavior:
Not crashing

Screenshots:
image

Device, Browser, OS:
Chrome Version 98.0.4758.80 (Official Build) (arm64)

Editor.js version:
2.23.1

Plugins you use with their versions:
None

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions