mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-25 08:24:06 +01:00
Improve onDataChanged method (#16472)
* 🐛 Improve onDataChanged method fix https://github.com/siyuan-note/siyuan/pull/16244 重构、修复插件重启逻辑 重构 比如插件在 onload() 中插入了图标,uninstall 会把图标删除,afterLoadPlugin 又不能执行 onload() 把图标加回来 使用 getElementById 先加载插件样式 避免插入重复的样式 改进插件样式插入位置 * reloadPlugin
This commit is contained in:
parent
d620daa530
commit
bcdef64d0f
4 changed files with 60 additions and 37 deletions
|
|
@ -8,7 +8,7 @@ import {Constants} from "../constants";
|
|||
import {setStorageVal} from "../protyle/util/compatibility";
|
||||
import {getAllEditor} from "../layout/getAll";
|
||||
|
||||
export const uninstall = (app: App, name: string, isUninstall: boolean) => {
|
||||
export const uninstall = (app: App, name: string, isUninstall: boolean, keepCSS: boolean = false) => {
|
||||
app.plugins.find((plugin: Plugin, index) => {
|
||||
if (plugin.name === name) {
|
||||
try {
|
||||
|
|
@ -75,7 +75,9 @@ export const uninstall = (app: App, name: string, isUninstall: boolean) => {
|
|||
editor.protyle.toolbar.update(editor.protyle);
|
||||
});
|
||||
// rm style
|
||||
document.getElementById("pluginsStyle" + name)?.remove();
|
||||
if (!keepCSS) {
|
||||
document.getElementById("pluginsStyle" + name)?.remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue