mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
This commit is contained in:
@@ -825,6 +825,9 @@ export class Dock {
|
||||
if (custom.parent) {
|
||||
custom.parent.parent.removeTab(custom.parent.id);
|
||||
}
|
||||
if (this.element.querySelectorAll(".dock__item").length === 1 ) {
|
||||
this.element.classList.add("fn__none");
|
||||
}
|
||||
delete this.data[key];
|
||||
}
|
||||
|
||||
|
||||
@@ -56,16 +56,40 @@ export const uninstall = (app: App, name: string, isReload: boolean) => {
|
||||
// rm dock
|
||||
const docksKeys = Object.keys(plugin.docks);
|
||||
docksKeys.forEach(key => {
|
||||
if (window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] && window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key]) {
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key].show =
|
||||
!!document.querySelector(`.dock__item[data-type="${key}"]`)?.classList.contains("dock__item--active");
|
||||
let dockIconElement;
|
||||
if (window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name] &&
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key]) {
|
||||
dockIconElement = document.querySelector(`.dock__item[data-type="${key}"]`);
|
||||
if (dockIconElement) {
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key].show = dockIconElement.classList.contains("dock__item--active");
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key].size = {
|
||||
height: parseInt(dockIconElement.getAttribute("data-height")) || null,
|
||||
width: parseInt(dockIconElement.getAttribute("data-width")) || null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(window.siyuan.layout.leftDock.data).includes(key)) {
|
||||
window.siyuan.layout.leftDock.remove(key);
|
||||
if (dockIconElement) {
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key].position =
|
||||
"Left" + (dockIconElement.getAttribute("data-index") === "0" ? "Top" : "Bottom");
|
||||
}
|
||||
} else if (Object.keys(window.siyuan.layout.rightDock.data).includes(key)) {
|
||||
window.siyuan.layout.rightDock.remove(key);
|
||||
if (dockIconElement) {
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key].position =
|
||||
"Right" + (dockIconElement.getAttribute("data-index") === "0" ? "Top" : "Bottom");
|
||||
}
|
||||
} else if (Object.keys(window.siyuan.layout.bottomDock.data).includes(key)) {
|
||||
window.siyuan.layout.bottomDock.remove(key);
|
||||
if (dockIconElement) {
|
||||
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][plugin.name][key].position =
|
||||
"Bottom" + (dockIconElement.getAttribute("data-index") === "0" ? "Left" : "Right");
|
||||
}
|
||||
}
|
||||
if (dockIconElement) {
|
||||
setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);
|
||||
}
|
||||
});
|
||||
/// #endif
|
||||
|
||||
Reference in New Issue
Block a user