Vanessa
2026-03-16 12:50:26 +08:00
parent bf29846992
commit 6fa6f41379
2 changed files with 30 additions and 3 deletions
+3
View File
@@ -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];
}
+27 -3
View File
@@ -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