mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-25 00:14:07 +01:00
🐛 The plugin was not executed uninstall() when being uninstalled (#16243)
fix https://github.com/siyuan-note/siyuan/issues/16156
This commit is contained in:
parent
a156dc9671
commit
33d63127b0
3 changed files with 18 additions and 15 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import {App} from "../index";
|
||||
import {Plugin} from "../plugin";
|
||||
import {Plugin} from "./index";
|
||||
/// #if !MOBILE
|
||||
import {getAllModels} from "../layout/getAll";
|
||||
import {resizeTopBar} from "../layout/util";
|
||||
|
|
@ -8,20 +8,23 @@ import {Constants} from "../constants";
|
|||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
import {getAllEditor} from "../layout/getAll";
|
||||
|
||||
export const uninstall = (app: App, name: string, isUninstall = false) => {
|
||||
export const uninstall = (app: App, name: string, isUninstall: boolean) => {
|
||||
app.plugins.find((plugin: Plugin, index) => {
|
||||
if (plugin.name === name) {
|
||||
// rm command
|
||||
try {
|
||||
plugin.onunload();
|
||||
if (isUninstall) {
|
||||
plugin.uninstall();
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {};
|
||||
setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`plugin ${plugin.name} onunload error:`, e);
|
||||
}
|
||||
if (isUninstall) {
|
||||
try {
|
||||
plugin.uninstall();
|
||||
} catch (e) {
|
||||
console.error(`plugin ${plugin.name} uninstall error:`, e);
|
||||
}
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {};
|
||||
setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);
|
||||
}
|
||||
// rm tab
|
||||
/// #if !MOBILE
|
||||
const modelsKeys = Object.keys(plugin.models);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue