Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/8277

Vanessa63c83a268529
diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts
index 8e242b9cfd..3ea80aa168 100644
--- a/app/src/plugin/index.ts
+++ b/app/src/plugin/index.ts
@@ -43,6 +43,10 @@ export class Plugin {
// 加载
}
+ public onunload() {
+ // 禁用/卸载
+ }
+
public addTopBar(options: {
icon: string,
title: string,
diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.ts
index 365d2d813f..33777ff664 100644
--- a/app/src/plugin/uninstall.ts
+++ b/app/src/plugin/uninstall.ts
@@ -6,6 +6,8 @@ import {exportLayout} from "../layout/util";
export const uninstall = (app: App, name: string) => {
app.plugins.find((plugin: Plugin, index) => {
if (plugin.name === name) {
+ // rm command
+ plugin.onunload();
// rm tab
const modelsKeys = Object.keys(plugin.models);
getAllModels().custom.forEach(custom => {
@@ -28,11 +30,6 @@ export const uninstall = (app: App, name: string) => {
window.siyuan.layout.bottomDock.remove(key);
}
});
- exportLayout({
- reload: false,
- onlyData: false,
- errorExit: false
- });
// rm listen
Array.from(document.childNodes).find(item => {
if (item.nodeType === 8 && item.textContent === name) {
@@ -42,6 +39,11 @@ export const uninstall = (app: App, name: string) => {
});
// rm plugin
app.plugins.splice(index, 1);
+ exportLayout({
+ reload: false,
+ onlyData: false,
+ errorExit: false
+ });
return true;
}
});