mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 05:46:10 +01:00
changes in access to startNote and currentNote
This commit is contained in:
@@ -11,11 +11,16 @@ const axios = require('axios');
|
||||
|
||||
function ScriptContext(dataKey, startNote, allNotes) {
|
||||
dataKey = protected_session.getDataKey(dataKey);
|
||||
const repository = new Repository(dataKey);
|
||||
|
||||
this.__startNote = startNote;
|
||||
this.__notes = utils.toObject(allNotes, note => [note.noteId, note]);
|
||||
this.__modules = {};
|
||||
this.modules = {};
|
||||
this.notes = utils.toObject(allNotes, note => [note.noteId, note]);
|
||||
this.apis = utils.toObject(allNotes, note => [note.noteId, new ScriptApi(dataKey, startNote, note)]);
|
||||
}
|
||||
|
||||
function ScriptApi(dataKey, startNote, currentNote) {
|
||||
const repository = new Repository(dataKey);
|
||||
this.startNote = startNote;
|
||||
this.currentNote = currentNote;
|
||||
|
||||
this.axios = axios;
|
||||
|
||||
@@ -50,7 +55,7 @@ function ScriptContext(dataKey, startNote, allNotes) {
|
||||
|
||||
this.updateEntity = repository.updateEntity;
|
||||
|
||||
this.log = message => log.info(`Script: ${message}`);
|
||||
this.log = message => log.info(`Script ${currentNote.noteId}: ${message}`);
|
||||
|
||||
this.getRootCalendarNoteId = date_notes.getRootCalendarNoteId;
|
||||
this.getDateNoteId = date_notes.getDateNoteId;
|
||||
|
||||
Reference in New Issue
Block a user