mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
6dd6d7401a
commit
1e3ca6bcde
3 changed files with 10 additions and 3 deletions
|
|
@ -730,7 +730,7 @@ export const bazaar = {
|
||||||
this._genMyHTML(bazaarType, app);
|
this._genMyHTML(bazaarType, app);
|
||||||
bazaar._onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
|
bazaar._onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
|
||||||
if (bazaarType === "plugins") {
|
if (bazaarType === "plugins") {
|
||||||
uninstall(app, packageName);
|
uninstall(app, packageName, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,11 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public onunload() {
|
public onunload() {
|
||||||
// 禁用/卸载
|
// 禁用/关闭
|
||||||
|
}
|
||||||
|
|
||||||
|
public uninstall() {
|
||||||
|
// 卸载
|
||||||
}
|
}
|
||||||
|
|
||||||
public onLayoutReady() {
|
public onLayoutReady() {
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,15 @@ import {Plugin} from "../plugin";
|
||||||
import {getAllModels} from "../layout/getAll";
|
import {getAllModels} from "../layout/getAll";
|
||||||
import {resizeTopBar} from "../layout/util";
|
import {resizeTopBar} from "../layout/util";
|
||||||
|
|
||||||
export const uninstall = (app: App, name: string) => {
|
export const uninstall = (app: App, name: string, isUninstall = false) => {
|
||||||
app.plugins.find((plugin: Plugin, index) => {
|
app.plugins.find((plugin: Plugin, index) => {
|
||||||
if (plugin.name === name) {
|
if (plugin.name === name) {
|
||||||
// rm command
|
// rm command
|
||||||
try {
|
try {
|
||||||
plugin.onunload();
|
plugin.onunload();
|
||||||
|
if (isUninstall) {
|
||||||
|
plugin.uninstall();
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`plugin ${plugin.name} onunload error:`, e);
|
console.error(`plugin ${plugin.name} onunload error:`, e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue