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
fix: empty editor is not saving the note
thecodrrea9a8d7d016c
diff --git a/apps/web/__e2e__/editor.test.js b/apps/web/__e2e__/editor.test.jsindex 0678591f9..8ee8e090b 100644--- a/apps/web/__e2e__/editor.test.js+++ b/apps/web/__e2e__/editor.test.js@@ -184,3 +184,25 @@ test("focus should not jump to editor while typing in title input", async () =>await expect(getEditorContent()).resolves.toBe("");});++test("select all & backspace should clear all content in editor", async () => {+ const selector = await createNoteAndCheckPresence();++ await page.focus(".mce-content-body");++ await page.keyboard.press("Shift+End");++ await page.waitForTimeout(500);++ await page.keyboard.press("Backspace");++ await page.waitForTimeout(200);++ await page.click(getTestId("notes-action-button"));++ await page.click(selector);++ await page.waitForSelector(".mce-content-body");++ await expect(getEditorContent()).resolves.toBe("");+});diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.jsindex 224fe1444..9d76f3462 100644--- a/apps/web/src/components/editor/index.js+++ b/apps/web/src/components/editor/index.js@@ -197,7 +197,7 @@ function Editor({ noteId, nonce }) {onSave={saveSession}sessionId={sessionId}onChange={(content, editor) => {- if (!content || content === EMPTY_CONTENT) return;+ if (!content) return;editorstore.get().setSessionContent({type: "tiny",diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.jsindex 648946c82..56a2eba5c 100644--- a/apps/web/src/components/editor/tinymce.js+++ b/apps/web/src/components/editor/tinymce.js@@ -266,14 +266,25 @@ function TinyMCE(props) {});}+ function onKeyUp(e) {+ if (e.key !== "Backspace") return;+ if (!editor.getHTML) return;++ editor.getHTML().then((html) => {+ onChange(html, editor);+ });+ }+editor.on("ScrollIntoView", onScrollIntoView);editor.on("tap", onTap);editor.on(changeEvents, onEditorChange);+ editor.on("keyup", onKeyUp);editor.once("remove", () => {console.log("removing");editor.off("ScrollIntoView", onScrollIntoView);editor.off("tap", onTap);editor.off(changeEvents, onEditorChange);+ editor.off("keyup", onKeyUp);});},toolbar_persist: true,