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
web: fix characters missing sometimes when creating a new note
Abdullah Attaea2277ea4e2c
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsxindex 159e77253..9ef5e4dae 100644--- a/apps/web/src/components/editor/index.tsx+++ b/apps/web/src/components/editor/index.tsx@@ -57,7 +57,7 @@ import {downloadAttachment,previewImageAttachment} from "../../common/attachments";-import { EV, EVENTS } from "@notesnook/core";+import { EVENTS } from "@notesnook/core";import { db } from "../../common/db";import Titlebox, { resizeTextarea } from "./title-box";import Config from "../../utils/config";diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex cdc8fcc06..4378eecfb 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -959,7 +959,18 @@ class EditorStore extends BaseStore<EditorStore> {if (index > -1) {if (options?.force)session.nonce = (state.sessions[index]?.nonce || 0) + 1;- state.sessions[index] = session;+ const oldSession = state.sessions[index];+ // SPECIAL CASE: when a user types in a new session, it gets converted+ // into a default session with the same id. In this case, we want to+ // keep the content that the user has typed in the editor instead of+ // replacing it with the content of the note (which can be stale).+ if (+ oldSession.type === "new" &&+ session.type === "default" &&+ !!oldSession.content+ )+ state.sessions[index] = { ...session, content: oldSession.content };+ else state.sessions[index] = session;} else state.sessions.push(session);});