In 2.28.x release, editorjs clear method triggers EditorJS onChange method with block-removed event type.
Side effect of it being, upon toggling readOnly - all the blocks are being cleared and re-rendered. With these events, the onChange event listener ends up deleting the blocks that are stored in our local state that are updated based on block-update, block-created and block-removed events.
What we would need is some sort of flag to differentiate between actual delete vs clear + re-render for us to ignore such events on event listener.
Describe a bug.
In 2.28.x release, editorjs clear method triggers EditorJS onChange method with block-removed event type.
Side effect of it being, upon toggling readOnly - all the blocks are being cleared and re-rendered. With these events, the onChange event listener ends up deleting the blocks that are stored in our local state that are updated based on block-update, block-created and block-removed events.
What we would need is some sort of flag to differentiate between actual delete vs clear + re-render for us to ignore such events on event listener.
Steps to reproduce:
Here is the code snippet from readOnly.ts
https://github.com/codex-team/editor.js/blob/next/src/components/modules/readonly.ts#L97-#L102
Expected behavior:
Screenshots:
Device, Browser, OS:
Editor.js version:
Plugins you use with their versions: