mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
backend API note creation updates
This commit is contained in:
parent
420be6d8c6
commit
19206d1e0d
@ -2,6 +2,9 @@
|
|||||||
# Instance name can be used to distinguish between different instances
|
# Instance name can be used to distinguish between different instances
|
||||||
instanceName=
|
instanceName=
|
||||||
|
|
||||||
|
# Disable automatically generating desktop icon
|
||||||
|
# noDesktopIcon=true
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
# host setting is relevant only for web deployments - set the host on which the server will listen
|
# host setting is relevant only for web deployments - set the host on which the server will listen
|
||||||
# host=0.0.0.0
|
# host=0.0.0.0
|
||||||
|
@ -177,19 +177,55 @@ function BackendScriptApi(currentNote, apiParams) {
|
|||||||
* @property {string} [value] - attribute value
|
* @property {string} [value] - attribute value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create text note. See also createNote() for more options.
|
||||||
|
*
|
||||||
|
* @param {string} parentNoteId
|
||||||
|
* @param {string} title
|
||||||
|
* @param {string} content
|
||||||
|
* @return {Promise<{note: Note, branch: Branch}>}
|
||||||
|
*/
|
||||||
|
this.createTextNote = async (parentNoteId, title, content = '') => await noteService.createNewNote({
|
||||||
|
parentNoteId,
|
||||||
|
title,
|
||||||
|
content,
|
||||||
|
type: 'text'
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and
|
||||||
|
* JSON MIME type. See also createNote() for more options.
|
||||||
|
*
|
||||||
|
* @param {string} parentNoteId
|
||||||
|
* @param {string} title
|
||||||
|
* @param {object} content
|
||||||
|
* @return {Promise<{note: Note, branch: Branch}>}
|
||||||
|
*/
|
||||||
|
this.createDataNote = async (parentNoteId, title, content = {}) => await noteService.createNewNote({
|
||||||
|
parentNoteId,
|
||||||
|
title,
|
||||||
|
content: JSON.stringify(content),
|
||||||
|
type: 'code',
|
||||||
|
mime: 'application/json'
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} CreateNoteParams
|
* @typedef {object} CreateNoteParams
|
||||||
* @property {boolean} [json=false] - should the note be JSON
|
* @property {string} parentNoteId - MANDATORY
|
||||||
* @property {boolean} [isProtected=false] - should the note be protected
|
* @property {string} title - MANDATORY
|
||||||
* @property {string} [type='text'] - note type
|
* @property {string|buffer} content - MANDATORY
|
||||||
* @property {string} [mime='text/html'] - MIME type of the note
|
* @property {string} type - text, code, file, image, search, book, relation-map - MANDATORY
|
||||||
* @property {CreateNoteAttribute[]} [attributes=[]] - attributes to be created for this note
|
* @property {string} mime - value is derived from default mimes for type
|
||||||
|
* @property {boolean} isProtected - default is false
|
||||||
|
* @property {boolean} isExpanded - default is false
|
||||||
|
* @property {string} prefix - default is empty string
|
||||||
|
* @property {int} notePosition - default is last existing notePosition in a parent + 10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
* @method
|
||||||
*
|
*
|
||||||
* @param {CreateNoteParams} [extraOptions={}]
|
* @param {CreateNoteParams} [params]
|
||||||
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
|
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
|
||||||
*/
|
*/
|
||||||
this.createNote = noteService.createNewNote;
|
this.createNote = noteService.createNewNote;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user