Skip to content

Commit

Permalink
🎨 tab 最小化
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 9, 2024
1 parent fb5021a commit a3c28bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/src/boot/onGetConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export const onGetConfig = (isStart: boolean, app: App) => {
window.siyuan.emojis = response.data as IEmoji[];
try {
JSONToLayout(app, isStart);
adjustLayout();
setTimeout(() => {
adjustLayout();
}); // 等待 dock 中 !this.pin 的 setTimeout
/// #if !BROWSER
sendGlobalShortcut(app);
/// #endif
Expand Down
4 changes: 3 additions & 1 deletion app/src/layout/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,8 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
}
});
let lastItem: HTMLElement;
while (layout.element.scrollWidth > layout.element.clientWidth) {
let index = Math.floor(window.innerWidth / 24);
while (layout.element.scrollWidth > layout.element.clientWidth && index > 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";
Expand All @@ -886,6 +887,7 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
return true;
}
});
index--;
}
if (lastItem) {
lastItem.style.maxWidth = Math.max(Math.min(lastItem.clientWidth, window.innerWidth) - 8, 64) + "px";
Expand Down

0 comments on commit a3c28bb

Please sign in to comment.