mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
Script API changes, finished porting reddit plugin, reddit importer tar file
This commit is contained in:
@@ -2,15 +2,24 @@ const log = require('./log');
|
||||
const protected_session = require('./protected_session');
|
||||
const notes = require('./notes');
|
||||
const sql = require('./sql');
|
||||
const utils = require('./utils');
|
||||
const attributes = require('./attributes');
|
||||
const date_notes = require('./date_notes');
|
||||
const config = require('./config');
|
||||
const Repository = require('./repository');
|
||||
const axios = require('axios');
|
||||
|
||||
function ScriptContext(dataKey) {
|
||||
dataKey = protected_session.getDataKey(dataKey);
|
||||
const repository = new Repository(dataKey);
|
||||
|
||||
this.axios = axios;
|
||||
|
||||
this.utils = {
|
||||
unescapeHtml: utils.unescapeHtml,
|
||||
isoDateTimeStr: utils.dateStr
|
||||
};
|
||||
|
||||
this.getInstanceName = () => config.General ? config.General.instanceName : null;
|
||||
|
||||
this.getNoteById = async function(noteId) {
|
||||
@@ -30,7 +39,7 @@ function ScriptContext(dataKey) {
|
||||
this.createNote = async function(parentNoteId, title, content = "", extraOptions = {}) {
|
||||
extraOptions.dataKey = dataKey;
|
||||
|
||||
notes.createNote(parentNoteId, title, content, extraOptions);
|
||||
return await notes.createNote(parentNoteId, title, content, extraOptions);
|
||||
};
|
||||
|
||||
this.createAttribute = attributes.createAttribute;
|
||||
|
||||
Reference in New Issue
Block a user