mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-08 00:04:21 +01:00
This commit is contained in:
parent
cabe855372
commit
e674cfec70
4 changed files with 17 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import {API} from "./API";
|
|||
import {getFrontend, isMobile, isWindow} from "../util/functions";
|
||||
import {Constants} from "../constants";
|
||||
import {uninstall} from "./uninstall";
|
||||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
|
||||
const requireFunc = (key: string) => {
|
||||
const modules = {
|
||||
|
|
@ -102,6 +103,11 @@ const updateDock = (dockItem: Config.IUILayoutDockTab[], index: number, plugin:
|
|||
plugin.docks[tabItem.type].config.index = tabIndex;
|
||||
plugin.docks[tabItem.type].config.show = tabItem.show;
|
||||
plugin.docks[tabItem.type].config.size = tabItem.size;
|
||||
if (!window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name]) {
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] = {}
|
||||
}
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][tabItem.type] = plugin.docks[tabItem.type].config;
|
||||
setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -153,6 +159,9 @@ export const afterLoadPlugin = (plugin: Plugin) => {
|
|||
updateDock(dockItem, index, plugin, "Bottom");
|
||||
});
|
||||
Object.keys(plugin.docks).forEach(key => {
|
||||
if (window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key]) {
|
||||
plugin.docks[key].config = window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key];
|
||||
}
|
||||
const dock = plugin.docks[key];
|
||||
const hotkey = window.siyuan.config.keymap.plugin[plugin.name] ? window.siyuan.config.keymap.plugin[plugin.name][key]?.custom : undefined;
|
||||
if (dock.config.position.startsWith("Left")) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import {Plugin} from "../plugin";
|
|||
import {getAllModels} from "../layout/getAll";
|
||||
import {resizeTopBar} from "../layout/util";
|
||||
/// #endif
|
||||
import {Constants} from "../constants";
|
||||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
|
||||
export const uninstall = (app: App, name: string, isUninstall = false) => {
|
||||
app.plugins.find((plugin: Plugin, index) => {
|
||||
|
|
@ -13,6 +15,8 @@ export const uninstall = (app: App, name: string, isUninstall = false) => {
|
|||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue