mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
common JS module system prototype
This commit is contained in:
@@ -9,12 +9,21 @@ const config = require('./config');
|
||||
const Repository = require('./repository');
|
||||
const axios = require('axios');
|
||||
|
||||
function ScriptContext(dataKey) {
|
||||
function ScriptContext(dataKey, note, allNotes) {
|
||||
dataKey = protected_session.getDataKey(dataKey);
|
||||
const repository = new Repository(dataKey);
|
||||
|
||||
this.axios = axios;
|
||||
|
||||
this.__startNote = note;
|
||||
this.__notes = {};
|
||||
|
||||
if (allNotes) {
|
||||
allNotes.forEach(note => this.__notes[note.noteId] = note);
|
||||
}
|
||||
|
||||
this.__modules = {};
|
||||
|
||||
this.utils = {
|
||||
unescapeHtml: utils.unescapeHtml,
|
||||
isoDateTimeStr: utils.dateStr
|
||||
|
||||
Reference in New Issue
Block a user