diff --git a/priv/static/js/components.js b/priv/static/js/components.js index b9fe8d9..563a98f 100644 --- a/priv/static/js/components.js +++ b/priv/static/js/components.js @@ -697,6 +697,13 @@ class NoteForm extends HTMLElement { detail: this.note, }), ); + } else { + this.dispatchEvent( + new CustomEvent("updateNoteInProgress", { + bubbles: true, + detail: this.note, + }), + ); } } diff --git a/priv/static/js/jenot.js b/priv/static/js/jenot.js index 14ccffd..6ad2d93 100644 --- a/priv/static/js/jenot.js +++ b/priv/static/js/jenot.js @@ -127,6 +127,12 @@ newNote.addEventListener("deleteNote", async (e) => { await Notes.clearDraft(); }); +editNote.addEventListener("updateNoteInProgress", async (e) => { + const note = e.detail; + note.updated = Date.now(); + await Notes.update(note, true); +}); + editNote.addEventListener("updateNote", async (e) => { await Notes.update(e.detail); Notes.saveStorage();