mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 08:16:40 +01:00
backend API to create a launcher
This commit is contained in:
@@ -134,7 +134,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} CreateOrUpdateLauncherOptions
|
||||
* @typedef {Object} AddButtonToToolbarOptions
|
||||
* @property {string} [id] - id of the button, used to identify the old instances of this button to be replaced
|
||||
* ID is optional because of BC, but not specifying it is deprecated. ID can be alphanumeric only.
|
||||
* @property {string} title
|
||||
@@ -146,10 +146,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
/**
|
||||
* Adds a new launcher to the launchbar. If the launcher (id) already exists, it will be updated.
|
||||
*
|
||||
* @deprecated you can now create/modify launchers in the
|
||||
* @param {CreateOrUpdateLauncherOptions} opts
|
||||
* @deprecated you can now create/modify launchers in the top-left Menu -> Configure Launchbar
|
||||
* @param {AddButtonToToolbarOptions} opts
|
||||
*/
|
||||
this.addButtonToToolbar = async opts => {
|
||||
console.warn("api.addButtonToToolbar() has been deprecated since v0.58 and may be removed in the future. Use Menu -> Configure Launchbar to create/update launchers instead.");
|
||||
|
||||
const {action, ...reqBody} = opts;
|
||||
reqBody.action = action.toString();
|
||||
|
||||
@@ -163,7 +165,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
|
||||
return params.map(p => {
|
||||
if (typeof p === "function") {
|
||||
return "!@#Function: " + p.toString();
|
||||
return `!@#Function: ${p.toString()}`;
|
||||
}
|
||||
else {
|
||||
return p;
|
||||
@@ -199,7 +201,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
return ret.executionResult;
|
||||
}
|
||||
else {
|
||||
throw new Error("server error: " + ret.error);
|
||||
throw new Error(`server error: ${ret.error}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -590,7 +592,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
|
||||
this.log = message => {
|
||||
const {noteId} = this.startNote;
|
||||
|
||||
message = utils.now() + ": " + message;
|
||||
message = `${utils.now()}: ${message}`;
|
||||
|
||||
console.log(`Script ${noteId}: ${message}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user