e.g. "ctrl+shift+a"
specify namespace of the handler for the cases where call for bind may be repeated. If a handler with this ID exists, it's replaced by the new handler.
Create a note link (jQuery object) for given note.
(or noteId)
Note where the script is currently executing, i.e. the note where the currently executing source code is written.
day.js library for date manipulation. See https://day.js.org for documentation
this is producing local time! *
in bytes
formatted string
in bytes
formatted string
Returns day note for a given date. If it doesn't exist, it is automatically created.
Returns month-note. If it doesn't exist, it is automatically created.
Returns quarter note for given date. If such a note doesn't exist, it is automatically created.
Returns date-note for today. If it doesn't exist, it is automatically created.
Returns day note for the first date of the week of the given date. If it doesn't exist, it is automatically created.
Returns week note for given date. If such a note doesn't exist, it is automatically created.
Returns year-note. If it doesn't exist, it is automatically created.
Entity whose event triggered this execution.
true to protect note, false to unprotect
true to protect subtree, false to unprotect
Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
random string
jquery object on which to set up the tooltip
Show confirm dialog to the user.
promise resolving to true if the user confirmed
Show an error toast message to the user.
Show an info dialog to the user.
Show an info toast message to the user.
Show prompt dialog to the user.
promise resolving to the answer provided by the user
Note where the script started executing, i.e., the (event) entrypoint of the current script execution.
Trigger command. This is a very low-level API which should be avoided if possible.
Trigger event. This is a very low-level API which should be avoided if possible.
Trilium runs in a backend and frontend process, when something is changed on the backend from a script, frontend will get asynchronously synchronized.
This method returns a promise which resolves once all the backend -> frontend synchronization is finished. Typical use case is when a new note has been created, we should wait until it is synced into frontend and only then activate it.
Activates newly created note. Compared to this.activateNote() also makes sure that frontend has been fully synced.
(or noteId)
Activates note in the tree and in the note detail.
(or noteId)
Adds a new launcher to the launchbar. If the launcher (id) already exists, it will be updated.
Adds given text to the editor cursor
this must be clear text, HTML is not supported.
returns active context (split)
instance of CodeMirror
active note (loaded into center pane)
returns a note path of active note or null if there isn't active note
See https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html for documentation on the returned instance.
instance of CKEditor
returns active main context (first split in a tab, represents the tab as a whole)
Get access to the widget handling note detail. Methods like getWidgetType()
and getTypeWidget()
to get to the
implementation of actual widget type.
Returns component which owns the given DOM element (the nearest parent component in DOM tree)
DOM element
Instance name identifies particular Trilium instance. It can be useful for scripts if some action needs to happen on only one specific instance.
returns all main contexts representing tabs
Returns note by given noteId. If note is missing from the cache, it's loaded.
returns all note contexts (splits) in all tabs
Returns list of notes. If note is missing from the cache, it's loaded.
This is often used to bulk-fill the cache with notes which would have to be picked one by one otherwise (by e.g. createLink())
Optional
silentNotFoundError: booleandon't report error if the note is not found
Log given message to the log pane in UI
Open a note in a new split.
(or noteId)
set to true to activate the new split, false to stay on the current split
This will refresh all currently opened notes which have included note specified in the parameter
noteId of the included note
Update frontend tree (note) cache from the backend.
Executes given anonymous function on the backend. Internally this serializes the anonymous function into string and sends it to backend via AJAX. This function is meant for advanced needs where an async function is necessary. In this case, the automatic request-scoped transaction management is not applied, and you need to manually define transaction via api.transactional().
If you have a synchronous function, please use api.runOnBackend().
(synchronous) function to be executed on the backend
list of parameters to the anonymous function to be sent to backend
return value of the executed function on the backend
Executes given anonymous function on the backend. Internally this serializes the anonymous function into string and sends it to backend via AJAX. Please make sure that the supplied function is synchronous. Only sync functions will work correctly with transaction management. If you really know what you're doing, you can call api.runAsyncOnBackendWithManualTransactionHandling()
(synchronous) function to be executed on the backend
list of parameters to the anonymous function to be sent to backend
return value of the executed function on the backend
This is a powerful search method - you can search by attributes and their values, e.g.: "#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html
This is a powerful search method - you can search by attributes and their values, e.g.: "#dateModified =* MONTH AND #log". See full documentation for all options at: https://triliumnext.github.io/Docs/Wiki/search.html
Hoist note in the current tab. See https://triliumnext.github.io/Docs/Wiki/note-hoisting.html
set hoisted note. 'root' will effectively unhoist
Container of all the rendered script content