+
+
+

+ ${window.siyuan.languages.siyuanNote}
+
+
${window.siyuan.languages.slogan}
+
+
+
+
+
+ ${window.siyuan.languages.search}
+ ${updateHotkeyTip(window.siyuan.config.keymap.general.globalSearch.custom)}
+
+
+
+ ${window.siyuan.languages.recentDocs}
+ ${updateHotkeyTip(window.siyuan.config.keymap.general.recentDocs.custom)}
+
+
+
+ ${window.siyuan.languages.dataHistory}
+ ${updateHotkeyTip(window.siyuan.config.keymap.general.dataHistory.custom)}
+
+
+
+ ${window.siyuan.languages.newFile}
+ ${updateHotkeyTip(window.siyuan.config.keymap.general.newFile.custom)}
+
+
+
+ ${window.siyuan.languages.newNotebook}
+
+
+
+ ${window.siyuan.languages.userGuide}
-
${window.siyuan.languages.slogan}
-
-
-
-
- ${window.siyuan.languages.search}
- ${updateHotkeyTip(window.siyuan.config.keymap.general.globalSearch.custom)}
-
-
-
- ${window.siyuan.languages.recentDocs}
- ${updateHotkeyTip(window.siyuan.config.keymap.general.recentDocs.custom)}
-
-
-
- ${window.siyuan.languages.dataHistory}
- ${updateHotkeyTip(window.siyuan.config.keymap.general.dataHistory.custom)}
-
-
-
- ${window.siyuan.languages.newFile}
- ${updateHotkeyTip(window.siyuan.config.keymap.general.newFile.custom)}
-
-
-
- ${window.siyuan.languages.newNotebook}
-
-
-
- ${window.siyuan.languages.userGuide}
`,
callback(tab: Tab) {
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 85f1d0c5b..17d34d477 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -987,19 +987,22 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
}
});
let lastItem: HTMLElement;
- let index = Math.floor(window.innerWidth / 24);
- // +2 由于某些分辨率下 scrollWidth 会大于 clientWidth
- while (layout.element.scrollWidth > layout.element.clientWidth + 2 && 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";
- lastItem = item.element;
+ let index = Math.ceil(screen.width / 8);
+ if (layout.direction === "lr") {
+ 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;
+ });
+ index--;
+ if (width <= layout.element.clientWidth) {
+ break;
}
- if (layout.element.scrollWidth <= layout.element.clientWidth + 2) {
- return true;
- }
- });
- index--;
+ }
}
if (lastItem) {
lastItem.style.maxWidth = Math.max(Math.min(lastItem.clientWidth, window.innerWidth) - 8, 64) + "px";