🎨 tab 最小化

This commit is contained in:
Vanessa 2024-01-09 20:15:21 +08:00
parent fb5021a018
commit a3c28bbb4d
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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";
@ -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";