mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
refactoring of note creation APIs WIP
This commit is contained in:
@@ -57,14 +57,17 @@ async function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSw
|
||||
|
||||
const parentNote = await repository.getNote(parentNoteId);
|
||||
|
||||
const {note} = await noteService.createNote(parentNoteId, fileName, buffer, {
|
||||
target: 'into',
|
||||
const {note} = await noteService.createNewNote({
|
||||
parentNoteId,
|
||||
title: fileName,
|
||||
content: buffer,
|
||||
type: 'image',
|
||||
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
|
||||
mime: 'image/' + imageFormat.ext.toLowerCase(),
|
||||
attributes: [{ type: 'label', name: 'originalFileName', value: originalName }]
|
||||
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable()
|
||||
});
|
||||
|
||||
await note.addLabel('originalFileName', originalName);
|
||||
|
||||
return {
|
||||
fileName,
|
||||
note,
|
||||
|
||||
Reference in New Issue
Block a user