don't use deprecated/removed functions

zadam 2023-02-17 23:02:54 +01:00
parent 0b3a1c4970
commit 6ac0d0ca7a
4 changed files with 8 additions and 8 deletions

@ -36,7 +36,7 @@ It's possible to customize the title of generated date notes by defining a `#dat
## 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.

@ -63,8 +63,8 @@ e.g. old script looked like this:
const todayDateStr = api.formatDateISO(new Date());
const todayNote = await api.runOnServer(async todayDateStr => {
const dateNote = await api.getDateNote(todayDateStr);
const todayNote = await api.runOnBackend(async todayDateStr => {
const dateNote = await api.getDayNote(todayDateStr);
({note: logNote} = await api.createNote(dateNote.noteId, 'log'));
}, [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 todayNote = await api.runOnServer(todayDateStr => {
const dateNote = api.getDateNote(todayDateStr);
const todayNote = await api.runOnBackend(todayDateStr => {
const dateNote = api.getDayNote(todayDateStr);
({note: logNote} = api.createNote(dateNote.noteId, 'log'));
}, [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 {
font-size: 120%;
}
}

@ -27,7 +27,7 @@ api.addButtonToToolbar({
action: async () => {
// creating notes is backend (server) responsibility so we need to pass
// the control there
const taskNoteId = await api.runOnServer(async () => {
const taskNoteId = await api.runOnBackend(async () => {
const todoRootNote = await api.getNoteWithLabel('taskTodoRoot');
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
async function getChartData() {
const days = await api.runOnServer(async () => {
const days = await api.runOnBackend(async () => {
const notes = await api.getNotesWithLabel('weight');
const days = [];