Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/17208

Vanessa6fa6f4137936
diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts
index d148c03d9f..beec2df387 100644
--- a/app/src/layout/dock/index.ts
+++ b/app/src/layout/dock/index.ts
@@ -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];
}
diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.ts
index 0e19e4c324..1bb2b37901 100644
--- a/app/src/plugin/uninstall.ts
+++ b/app/src/plugin/uninstall.ts
@@ -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