mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-02-13 17:18:32 -06:00
support for backend jobs and other script API changes
This commit is contained in:
@@ -174,6 +174,8 @@ const noteEditor = (function() {
|
||||
codeEditor.setOption("mode", info.mime);
|
||||
CodeMirror.autoLoadMode(codeEditor, info.mode);
|
||||
}
|
||||
|
||||
codeEditor.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ const server = (function() {
|
||||
}
|
||||
|
||||
function prepareParams(params) {
|
||||
if (!params) {
|
||||
return params;
|
||||
}
|
||||
|
||||
return params.map(p => {
|
||||
if (typeof p === "function") {
|
||||
return "!@#Function: " + p.toString();
|
||||
@@ -52,6 +56,13 @@ const server = (function() {
|
||||
return ret.executionResult;
|
||||
}
|
||||
|
||||
async function setJob(opts) {
|
||||
opts.job = opts.job.toString();
|
||||
opts.params = prepareParams(opts.params);
|
||||
|
||||
await post('script/job', opts);
|
||||
}
|
||||
|
||||
let i = 1;
|
||||
const reqResolves = {};
|
||||
|
||||
@@ -116,6 +127,7 @@ const server = (function() {
|
||||
put,
|
||||
remove,
|
||||
exec,
|
||||
setJob,
|
||||
ajax,
|
||||
// don't remove, used from CKEditor image upload!
|
||||
getHeaders
|
||||
|
||||
Reference in New Issue
Block a user