editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

Ability to differentiate block content delete vs clear / re-renders.

Open krisnik opened this issue 2 years ago • 2 comments

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:

krisnik avatar Oct 11 '23 08:10 krisnik

Hello @neSpecc , Could you please suggest a work around / solution here?

krisnik avatar Oct 19 '23 07:10 krisnik

Having the same issue

ErBat avatar May 22 '24 12:05 ErBat