diff --git a/app/src/layout/dock/index.ts b/app/src/layout/dock/index.ts index fe49c59fc..8c739bbfe 100644 --- a/app/src/layout/dock/index.ts +++ b/app/src/layout/dock/index.ts @@ -9,7 +9,7 @@ import {Bookmark} from "./Bookmark"; import {Tag} from "./Tag"; import {Graph} from "./Graph"; import {Model} from "../Model"; -import {saveLayout, setPanelFocus} from "../util"; +import {adjustLayout, saveLayout, setPanelFocus} from "../util"; import {getDockByType, resizeTabs} from "../tabUtil"; import {Inbox} from "./Inbox"; import {Protyle} from "../../protyle"; @@ -707,7 +707,8 @@ export class Dock { this.layout.element.style.opacity = ""; this.hideResizeTimeout = window.setTimeout(() => { this.resizeElement.classList.remove("fn__none"); - }, 200); // 需等待动画完毕后再出现,否则会出现滚动条 https://ld246.com/article/1676596622064 + adjustLayout(); + }, Constants.TIMEOUT_TRANSITION); // 需等待动画完毕后再出现,否则会出现滚动条 https://ld246.com/article/1676596622064 } if (document.activeElement) { (document.activeElement as HTMLElement).blur(); diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 17d34d477..06eccdbeb 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -986,15 +986,13 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout. item.element.style.minWidth = ""; } }); - let lastItem: HTMLElement; - let index = Math.ceil(screen.width / 8); - if (layout.direction === "lr") { + if (layout.direction === "lr" && layout.element.scrollWidth > layout.element.clientWidth + 2 ) { + let index = Math.ceil(screen.width / 8); while (index > 0) { let width = 0; layout.children.find((item: Layout | Wnd) => { if (item.element.style.width && item.element.style.width !== "0px") { item.element.style.maxWidth = Math.max(Math.min(item.element.clientWidth, window.innerWidth) - 8, 64) + "px"; - lastItem = item.element; } width += item.element.clientWidth; }); @@ -1004,9 +1002,6 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout. } } } - if (lastItem) { - lastItem.style.maxWidth = Math.max(Math.min(lastItem.clientWidth, window.innerWidth) - 8, 64) + "px"; - } layout.children.forEach((item: Layout | Wnd) => { if (item instanceof Layout && item.size !== "0px") { adjustLayout(item);