mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-03 06:22:55 +00:00
Implement saving edited note in progress
This commit is contained in:
parent
b3ba84f54b
commit
6235cd677d
2 changed files with 13 additions and 0 deletions
|
|
@ -697,6 +697,13 @@ class NoteForm extends HTMLElement {
|
|||
detail: this.note,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("updateNoteInProgress", {
|
||||
bubbles: true,
|
||||
detail: this.note,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue