mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
createNote API now accepts attributes instead of just labels
This commit is contained in:
parent
a40bf71fd4
commit
8fb0de900b
@ -63,7 +63,8 @@ function ScriptApi(startNote, currentNote, originEntity = null) {
|
|||||||
parseDate: utils.parseDate,
|
parseDate: utils.parseDate,
|
||||||
showMessage: infoService.showMessage,
|
showMessage: infoService.showMessage,
|
||||||
showError: infoService.showError,
|
showError: infoService.showError,
|
||||||
reloadTree: treeService.reload,
|
reloadTree: treeService.reload, // deprecated
|
||||||
|
refreshTree: treeService.reload,
|
||||||
createNoteLink: linkService.createNoteLink
|
createNoteLink: linkService.createNoteLink
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,11 +93,13 @@ async function createNote(parentNoteId, title, content = "", extraOptions = {})
|
|||||||
|
|
||||||
const {note, branch} = await createNewNote(parentNoteId, noteData);
|
const {note, branch} = await createNewNote(parentNoteId, noteData);
|
||||||
|
|
||||||
// FIXME: need to make this more generic for all kinds of attributes
|
for (const attr of extraOptions.attributes || []) {
|
||||||
if (extraOptions.labels) {
|
await attributeService.createAttribute({
|
||||||
for (const labelName in extraOptions.labels) {
|
noteId: note.noteId,
|
||||||
await attributeService.createLabel(note.noteId, labelName, extraOptions.labels[labelName]);
|
type: attr.type,
|
||||||
}
|
name: attr.name,
|
||||||
|
value: attr.value
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await triggerNoteTitleChanged(note);
|
await triggerNoteTitleChanged(note);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user