mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user