editor.js: onChange event is triggered immediately on initialization

We have implemented an alert for the users when they try to leave the editor with some unsaved changes.

Basically when editorjs onChange is triggered, we set a variable unsavedChanges = true.

The problem is that onChange is triggered also immediately when the editor is loading… This means that if a user opens an existing document, they will always receive a warning about unsaved changes when they leave, even if they only opened the document and did not make any changes.

This is because editorjs triggers onChange immediately.

Expected: editorjs triggers onChange only when the user makes some changes in the editor Actual: editorjs triggers onChange when the user makes some changes in the editor AND when it is initialized with new EditorJS

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

I have found another plugin that is seems to be causing the same issue, to me it was the @editorjs/embed . Can anyone else confirm the same behavior?