aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/notes/NotesPage.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/notes/NotesPage.qml')
-rw-r--r--desktop/modules/notes/NotesPage.qml25
1 files changed, 17 insertions, 8 deletions
diff --git a/desktop/modules/notes/NotesPage.qml b/desktop/modules/notes/NotesPage.qml
index 585fcfb..1a82254 100644
--- a/desktop/modules/notes/NotesPage.qml
+++ b/desktop/modules/notes/NotesPage.qml
@@ -19,9 +19,11 @@ import "Notes.js" as Notes
//
// Save is two clicks and each click does one thing. The first writes the note
// and, when that has finished, arms the button as "Commit & push?"; the second
-// commits and pushes and returns to the list. Arming the second click only
-// after the write completes is what stops a quick second click from committing
-// a note the first click has not written yet.
+// writes whatever the editor holds now, then commits and pushes, then returns
+// to the list. The second click writes as well because the editor stays
+// editable in between: pushing without writing would throw away an edit made
+// after the first click. Arming only after the first write completes is what
+// stops a quick second click from committing a note that is not written yet.
//
// Nothing is remembered between visits: leaving the editor with text that was
// not saved drops it, which is the clipboard page's own rule.
@@ -78,12 +80,19 @@ Item {
// The note is already on disk and only the push is owed, so this click
// pushes rather than writing a second note.
if (page.awaiting !== "") {
- const id = page.awaiting === "create" ? page.owner.lastCreatedId : page.editing.id;
+ // The editor stays editable after the first click, so whatever was
+ // typed since is written before it is pushed: the push alone would
+ // leave that edit behind.
+ const kind = page.awaiting;
+ const id = kind === "create" ? page.owner.lastCreatedId : page.editing.id;
page.busy = true;
- page.owner.commitPush(page.awaiting, id, (ok, msg) => {
- page.busy = false;
- if (!ok) { page.owner.lastError = msg; return; }
- page.toList();
+ page.owner.update(id, titleField.text, bodyEdit.text, (ok, msg) => {
+ if (!ok) { page.busy = false; page.owner.lastError = msg; return; }
+ page.owner.commitPush(kind, id, (ok2, msg2) => {
+ page.busy = false;
+ if (!ok2) { page.owner.lastError = msg2; return; }
+ page.toList();
+ });
});
return;
}