Skip to content

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

web: clear editor on unlocking the note

Abdullah Attaf35a3d8fa3ab
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 6fdbe1d83..d8485cb97 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -290,12 +290,14 @@ class EditorStore extends BaseStore {
state: SESSION_STATES.new
};
});
- noteStore.setSelectedNote(0);
- this.toggleProperties(false);
- if (shouldNavigate)
- hashNavigate(`/notes/create`, { replace: true, addNonce: true });
- setTimeout(() => appStore.setIsEditorOpen(false), 100);
- setDocumentTitle();
+ setTimeout(() => {
+ noteStore.setSelectedNote(0);
+ this.toggleProperties(false);
+ if (shouldNavigate)
+ hashNavigate(`/notes/create`, { replace: true, addNonce: true });
+ appStore.setIsEditorOpen(false);
+ setDocumentTitle();
+ }, 100);
};
setTitle = (noteId, title) => {
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 78fcb6e20..5ea0a3a83 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -116,7 +116,7 @@ class NoteStore extends BaseStore {
unlock = async (id) => {
return await Vault.unlockNote(id).then(async (res) => {
if (editorStore.get().session.id === id)
- await editorStore.openSession(id);
+ await editorStore.clearSession(true);
this.refreshItem(id);
return res;
});