codex-team / codex-team/editor.js
onChange event is triggered immediately on initialization
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
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`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.