mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
5c641120ae
commit
82ce65fa7e
2 changed files with 5 additions and 1 deletions
|
|
@ -73,6 +73,10 @@ export class Plugin {
|
|||
position?: "right" | "left",
|
||||
callback: (evt: MouseEvent) => void
|
||||
}) {
|
||||
if (!options.icon.startsWith("icon") && !options.icon.startsWith("<svg")) {
|
||||
console.error(`plugin ${this.name} addTopBar error: icon must be svg id or svg tag`);
|
||||
return;
|
||||
}
|
||||
const iconElement = document.createElement("div");
|
||||
iconElement.setAttribute("data-menu", "true");
|
||||
iconElement.addEventListener("click", options.callback);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const loadPluginJS = async (app: App, item: IPluginData) => {
|
|||
try {
|
||||
runCode(item.js, "plugin:" + encodeURIComponent(item.name))(getObject, moduleObj, exportsObj);
|
||||
} catch (e) {
|
||||
console.error(`eval plugin ${item.name} error:`, e);
|
||||
console.error(`plugin ${item.name} run error:`, e);
|
||||
return;
|
||||
}
|
||||
const pluginClass = (moduleObj.exports || exportsObj).default || moduleObj.exports;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue