An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/14373
Vanessab8bf4401bb6c
diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.tsindex 3ff090a5c8..b0ac6ab2f6 100644--- a/app/src/plugin/loader.ts+++ b/app/src/plugin/loader.ts@@ -29,19 +29,21 @@ const runCode = (code: string, sourceURL: string) => {export const loadPlugins = async (app: App, names?: string[]) => {const response = await fetchSyncPost("/api/petal/loadPetals", {frontend: getFrontend()});- let css = "";+ let css = '<style id="pluginsStyle"></style>'; // 用于将内联样式插入到插件样式前的标识// 为加快启动速度,不进行 awaitresponse.data.forEach((item: IPluginData) => {if (!names || (names && names.includes(item.name))) {loadPluginJS(app, item);}- css += item.css || "" + "\n";+ if (item.css) {+ css += `<style id="pluginsStyle${item.name}">${item.css}</style>`;+ }});const pluginsStyle = document.getElementById("pluginsStyle");if (pluginsStyle) {pluginsStyle.innerHTML = css;} else {- document.head.insertAdjacentHTML("beforeend", `<style id="pluginsStyle">${css}</style>`);+ document.head.insertAdjacentHTML("beforeend", css);}};@@ -81,9 +83,12 @@ const loadPluginJS = async (app: App, item: IPluginData) => {// 启用插件export const loadPlugin = async (app: App, item: IPluginData) => {const plugin = await loadPluginJS(app, item);- const styleElement = document.createElement("style");- styleElement.textContent = item.css;- document.head.append(styleElement);+ if (item.css) {+ const styleElement = document.createElement("style");+ styleElement.id = "pluginsStyle" + item.name;+ styleElement.textContent = item.css;+ document.head.append(styleElement);+ }afterLoadPlugin(plugin);saveLayout();getAllEditor().forEach(editor => {diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.tsindex 71b558f117..7fba77cf33 100644--- a/app/src/plugin/uninstall.ts+++ b/app/src/plugin/uninstall.ts@@ -66,6 +66,8 @@ export const uninstall = (app: App, name: string, isUninstall = false) => {getAllEditor().forEach(editor => {editor.protyle.toolbar.update(editor.protyle);});+ // rm style+ document.getElementById("pluginsStyle" + name)?.remove();return true;}});