From 0a13fed4a2598e209da8c28f7ba634aeee631cbf Mon Sep 17 00:00:00 2001 From: schmeeve Date: Wed, 23 Sep 2026 17:27:37 -0700 Subject: [PATCH] autosave for existing notes --- static/app.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/static/app.js b/static/app.js index d137337..84ea647 100644 --- a/static/app.js +++ b/static/app.js @@ -470,7 +470,6 @@ function renderEditor(body, owner) { const isNew = !state.noteId; const back = el("button", { class: "btn ghost", text: "← Back", onclick: exitEditor }); - const save = isNew ? null : el("button", { class: "btn primary", text: "Save", onclick: saveNote }); const del = state.noteId ? el("button", { class: "btn danger", text: "Delete", onclick: deleteNote }) : null; const hist = state.noteId ? el("button", { class: "btn ghost", text: "History", onclick: showHistory }) : null; @@ -513,7 +512,7 @@ function renderEditor(body, owner) { const attach = el("button", { class: "btn", text: "Attach", onclick: () => fileInput.click() }); const wrap = el("div", { class: "editor-wrap" }, [ - el("div", { class: "editor-topbar" }, [back, ...(isNew ? [] : [spaceSel]), el("div", { class: "spacer" }), attach, hist, del, commonLabel, previewBtn, ...(isNew ? [] : [save])]), + el("div", { class: "editor-topbar" }, [back, ...(isNew ? [] : [spaceSel]), el("div", { class: "spacer" }), attach, hist, del, commonLabel, previewBtn]), toolbar, split, hint, @@ -583,18 +582,12 @@ async function persistNote() { } catch (e) { status.textContent = "Error: " + e.message; } } -async function saveNote() { - const isNew = !state.noteId; - await persistNote(); - if (isNew) showHome(); -} - function editorIsEmpty() { return !state.editor || state.editor.getText().trim() === ""; } async function exitEditor() { - if (!state.noteId && !editorIsEmpty()) { + if (state.noteId || !editorIsEmpty()) { await persistNote(); } showHome();