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/17919

Vanessadb2ead514991
diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts
index c384f316cc..7712f8e36d 100644
--- a/app/src/layout/dock/index.ts
+++ b/app/src/layout/dock/index.ts
@@ -754,11 +754,14 @@ export class Dock {
const type = sourceElement.getAttribute("data-type") as TDock;
const sourceDock = getDockByType(type);
// 仅在左右轴与下轴之间跨轴移动时清除尺寸:左右侧之间或下侧内部移动,原有尺寸维度仍然有效
+ const size: Partial<Config.IUILayoutDockPanelSize> = {};
if ((sourceDock.position === "Left" || sourceDock.position === "Right") && this.position === "Bottom") {
sourceElement.setAttribute("data-width", "");
+ size.width = null;
}
if (sourceDock.position === "Bottom" && (this.position === "Left" || this.position === "Right")) {
sourceElement.setAttribute("data-height", "");
+ size.height = null;
}
if (sourceDock.elements[0].parentElement.querySelectorAll(".dock__item").length === 1) {
sourceDock.elements[0].parentElement.classList.add("fn__none");
@@ -816,10 +819,7 @@ export class Dock {
this.saveLocalPlugin(type, {
index: sortIndex,
position,
- size: {
- height: null,
- width: null,
- }
+ size
});
adjustDockPadding();
this.adjustSplit();
@@ -937,7 +937,7 @@ export class Dock {
private saveLocalPlugin(dockType: TDock | string, options: {
position?: TPluginDockPosition,
- size?: Config.IUILayoutDockPanelSize,
+ size?: Partial<Config.IUILayoutDockPanelSize>,
index?: number,
show?: boolean
}) {
@@ -946,8 +946,14 @@ export class Dock {
if (!window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][pluginItem.name][dockType]) {
window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][pluginItem.name][dockType] = pluginItem.docks[dockType].config;
}
- Object.keys(options).forEach((item: "position") => {
- window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][pluginItem.name][dockType][item] = options[item];
+ const dockConfig = window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS][pluginItem.name][dockType];
+ Object.keys(options).forEach((item: "position" | "size" | "index" | "show") => {
+ // size 需按字段合并,否则会整体覆盖、丢失用户已拖动的尺寸
+ if (item === "size") {
+ Object.assign(dockConfig.size, options.size);
+ } else {
+ dockConfig[item] = options[item];
+ }
});
setStorageVal(Constants.LOCAL_PLUGIN_DOCKS, window.siyuan.storage[Constants.LOCAL_PLUGIN_DOCKS]);
return true;