mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
docs(user): use webviews for frontend & backend APIs
This commit is contained in:
@@ -57,7 +57,7 @@ These actions operate the <a class="reference-link" href="Attributes/Relations.
|
||||
|
||||
* **Rename note**
|
||||
* For each note, it will change the title of the note to the given one.
|
||||
* As a more advanced use case, the note can be a “template string” which allows for dynamic values with access to the note information via <a class="reference-link" href="../Scripting/Script%20API/Frontend%20API/FNote.md">FNote</a>, for example:
|
||||
* As a more advanced use case, the note can be a “template string” which allows for dynamic values with access to the note information via <a class="reference-link" href="../Scripting/Script%20API/Frontend%20API/FNote.dat">FNote</a>, for example:
|
||||
* `NEW: ${note.title}` will prefix all notes with `NEW:` .
|
||||
* `${note.dateCreatedObj.format('MM-DD:')}: ${note.title}` will prefix the note titles with each note's creation date (in month-day format).
|
||||
* **Move note**
|
||||
|
||||
@@ -17,7 +17,7 @@ And all children of "2022 Books" will be created with initial title "\[Author na
|
||||
|
||||
The value of `#titleTemplate` is evaluated at the point of note's creation as a JavaScript string, which means it can be enriched with the help of JS string interpolation with dynamic data.
|
||||
|
||||
Second variable injected is `parentNote` which gives access to the parent [`FNote`](../Scripting/Script%20API/Frontend%20API/FNote.md).
|
||||
Second variable injected is `parentNote` which gives access to the parent [`FNote`](../Scripting/Script%20API/Frontend%20API/FNote.dat).
|
||||
|
||||
See also <a class="reference-link" href="Templates.md">Templates</a> which provides similar capabilities, including default note's content.
|
||||
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
# Script API
|
||||
Trilium offers a "Script API" that enables scripts to perform various useful functions. There are two main APIs available:
|
||||
For [script code notes](../Scripting.md), Trilium offers an API that gives them access to various features of the application.
|
||||
|
||||
* [Frontend API](https://triliumnext.github.io/Notes/frontend_api/FrontendScriptApi.html)
|
||||
* [Backend API](https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html)
|
||||
There are two APIs:
|
||||
|
||||
Please note that the Script API is currently experimental and may undergo changes in future updates.
|
||||
* One for the front-end scripts: <a class="reference-link" href="Script%20API/Frontend%20API">Frontend API</a>
|
||||
* One for the back-end scripts: <a class="reference-link" href="Script%20API/Backend%20API.dat">Backend API</a>
|
||||
|
||||
In both cases, the API resides in a global variable, `api`, that can be used anywhere in the script.
|
||||
|
||||
For example, to display a message to the user the following front-end script can be used:
|
||||
|
||||
```
|
||||
api.showMessage("Hello world.");
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> **Note**
|
||||
> The Script API is currently experimental and may undergo changes in future updates.
|
||||
Reference in New Issue
Block a user