Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: changing notes did not reset undo levels

thecodrrc7f04fc0fe00
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index a24f7683d..3525ad179 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -73,13 +73,12 @@ function Editor({ noteId, nonce }) {
const editor = editorRef.current?.editor;
if (!editor) return;
function setContents() {
- editor.undoManager.clear();
- editor.undoManager.add();
- editor.setDirty(false);
-
// NOTE: workaround to not fire onEditorChange event on content load
editor.isLoading = true;
editor.setContent(data, { format: "html" });
+
+ editor.undoManager.reset();
+ editor.setDirty(false);
}
setContents();
editor.on("init", setContents);