saving attachments when editing

This commit is contained in:
zadam
2023-01-24 09:19:49 +01:00
parent f59e19d93b
commit c474e65cae
9 changed files with 43 additions and 25 deletions

View File

@@ -592,7 +592,7 @@ function saveNoteRevisionIfNeeded(note) {
}
}
function updateNoteContent(noteId, content) {
function updateNoteData(noteId, content, attachments = []) {
const note = becca.getNote(noteId);
if (!note.isContentAvailable()) {
@@ -604,6 +604,10 @@ function updateNoteContent(noteId, content) {
content = saveLinks(note, content);
note.setContent(content);
for (const {name, mime, content} of attachments) {
note.saveNoteAttachment(name, mime, content);
}
}
/**
@@ -998,7 +1002,7 @@ sqlInit.dbReady.then(() => {
module.exports = {
createNewNote,
createNewNoteWithTarget,
updateNoteContent,
updateNoteData,
undeleteNote,
protectNoteRecursively,
scanForLinks,