mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
This commit is contained in:
parent
c12547f6fd
commit
63c83a2685
2 changed files with 11 additions and 5 deletions
|
|
@ -43,6 +43,10 @@ export class Plugin {
|
||||||
// 加载
|
// 加载
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onunload() {
|
||||||
|
// 禁用/卸载
|
||||||
|
}
|
||||||
|
|
||||||
public addTopBar(options: {
|
public addTopBar(options: {
|
||||||
icon: string,
|
icon: string,
|
||||||
title: string,
|
title: string,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import {exportLayout} from "../layout/util";
|
||||||
export const uninstall = (app: App, name: string) => {
|
export const uninstall = (app: App, name: string) => {
|
||||||
app.plugins.find((plugin: Plugin, index) => {
|
app.plugins.find((plugin: Plugin, index) => {
|
||||||
if (plugin.name === name) {
|
if (plugin.name === name) {
|
||||||
|
// rm command
|
||||||
|
plugin.onunload();
|
||||||
// rm tab
|
// rm tab
|
||||||
const modelsKeys = Object.keys(plugin.models);
|
const modelsKeys = Object.keys(plugin.models);
|
||||||
getAllModels().custom.forEach(custom => {
|
getAllModels().custom.forEach(custom => {
|
||||||
|
|
@ -28,11 +30,6 @@ export const uninstall = (app: App, name: string) => {
|
||||||
window.siyuan.layout.bottomDock.remove(key);
|
window.siyuan.layout.bottomDock.remove(key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
exportLayout({
|
|
||||||
reload: false,
|
|
||||||
onlyData: false,
|
|
||||||
errorExit: false
|
|
||||||
});
|
|
||||||
// rm listen
|
// rm listen
|
||||||
Array.from(document.childNodes).find(item => {
|
Array.from(document.childNodes).find(item => {
|
||||||
if (item.nodeType === 8 && item.textContent === name) {
|
if (item.nodeType === 8 && item.textContent === name) {
|
||||||
|
|
@ -42,6 +39,11 @@ export const uninstall = (app: App, name: string) => {
|
||||||
});
|
});
|
||||||
// rm plugin
|
// rm plugin
|
||||||
app.plugins.splice(index, 1);
|
app.plugins.splice(index, 1);
|
||||||
|
exportLayout({
|
||||||
|
reload: false,
|
||||||
|
onlyData: false,
|
||||||
|
errorExit: false
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue