A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: prevent creation of multiple empty notes (#6922)
luis-4118fe381afa918
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex d7ec528d4..5434097ed 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -871,12 +871,19 @@ class EditorStore extends BaseStore<EditorStore> {};newSession = () => {- this.addSession({- type: "new",- id: getId(),- context: useNoteStore.getState().context,- saveState: SaveState.NotSaved- });+ const state = useEditorStore.getState();+ const session = state.sessions.find((session) => session.type === "new");+ if (session) {+ session.context = useNoteStore.getState().context;+ this.activateSession(session.id);+ } else {+ this.addSession({+ type: "new",+ id: getId(),+ context: useNoteStore.getState().context,+ saveState: SaveState.NotSaved+ });+ }};closeSessions = (...ids: string[]) => {