mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
don't use deprecated/removed functions
parent
0b3a1c4970
commit
6ac0d0ca7a
@ -36,7 +36,7 @@ It's possible to customize the title of generated date notes by defining a `#dat
|
|||||||
|
|
||||||
## Implementation
|
## Implementation
|
||||||
|
|
||||||
Trilium has some special support for day notes in the form of [backend Script API](https://zadam.github.io/trilium/backend_api/BackendScriptApi.html) - see e.g. getDateNote() function.
|
Trilium has some special support for day notes in the form of [backend Script API](https://zadam.github.io/trilium/backend_api/BackendScriptApi.html) - see e.g. getDayNote() function.
|
||||||
|
|
||||||
Day (and year, month) notes are created with a label - e.g. `#dateNote="2018-08-16"` this can then be used by other scripts to add new notes to day note etc.
|
Day (and year, month) notes are created with a label - e.g. `#dateNote="2018-08-16"` this can then be used by other scripts to add new notes to day note etc.
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ e.g. old script looked like this:
|
|||||||
|
|
||||||
const todayDateStr = api.formatDateISO(new Date());
|
const todayDateStr = api.formatDateISO(new Date());
|
||||||
|
|
||||||
const todayNote = await api.runOnServer(async todayDateStr => {
|
const todayNote = await api.runOnBackend(async todayDateStr => {
|
||||||
const dateNote = await api.getDateNote(todayDateStr);
|
const dateNote = await api.getDayNote(todayDateStr);
|
||||||
|
|
||||||
({note: logNote} = await api.createNote(dateNote.noteId, 'log'));
|
({note: logNote} = await api.createNote(dateNote.noteId, 'log'));
|
||||||
}, [todayDateStr]);
|
}, [todayDateStr]);
|
||||||
@ -75,8 +75,8 @@ all the `await` (and `async`) should disappear from the backend code, but should
|
|||||||
|
|
||||||
const todayDateStr = api.formatDateISO(new Date());
|
const todayDateStr = api.formatDateISO(new Date());
|
||||||
|
|
||||||
const todayNote = await api.runOnServer(todayDateStr => {
|
const todayNote = await api.runOnBackend(todayDateStr => {
|
||||||
const dateNote = api.getDateNote(todayDateStr);
|
const dateNote = api.getDayNote(todayDateStr);
|
||||||
|
|
||||||
({note: logNote} = api.createNote(dateNote.noteId, 'log'));
|
({note: logNote} = api.createNote(dateNote.noteId, 'log'));
|
||||||
}, [todayDateStr]);
|
}, [todayDateStr]);
|
||||||
@ -117,4 +117,4 @@ This prefixing is not needed anymore (and also doesn't work anymore). Remove the
|
|||||||
|
|
||||||
body .note-detail-editable-text, body .note-detail-readonly-text {
|
body .note-detail-editable-text, body .note-detail-readonly-text {
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ api.addButtonToToolbar({
|
|||||||
action: async () => {
|
action: async () => {
|
||||||
// creating notes is backend (server) responsibility so we need to pass
|
// creating notes is backend (server) responsibility so we need to pass
|
||||||
// the control there
|
// the control there
|
||||||
const taskNoteId = await api.runOnServer(async () => {
|
const taskNoteId = await api.runOnBackend(async () => {
|
||||||
const todoRootNote = await api.getNoteWithLabel('taskTodoRoot');
|
const todoRootNote = await api.getNoteWithLabel('taskTodoRoot');
|
||||||
const {note} = await api.createNote(todoRootNote.noteId, 'new task', '');
|
const {note} = await api.createNote(todoRootNote.noteId, 'new task', '');
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ To get an idea of the script, here's the "JS code" note content:
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
async function getChartData() {
|
async function getChartData() {
|
||||||
const days = await api.runOnServer(async () => {
|
const days = await api.runOnBackend(async () => {
|
||||||
const notes = await api.getNotesWithLabel('weight');
|
const notes = await api.getNotesWithLabel('weight');
|
||||||
const days = [];
|
const days = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user