Vanessa
2026-06-24 22:39:29 +08:00
parent 455fd313e0
commit db2ead5149
+13 -7
View File
@@ -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;