mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
This commit is contained in:
@@ -43,6 +43,10 @@ export class Plugin {
|
||||
// 加载
|
||||
}
|
||||
|
||||
public onunload() {
|
||||
// 禁用/卸载
|
||||
}
|
||||
|
||||
public addTopBar(options: {
|
||||
icon: string,
|
||||
title: string,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user