mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
f6dcda59bb
commit
9366b0f073
3 changed files with 53 additions and 49 deletions
|
|
@ -148,10 +148,9 @@
|
|||
width: 100%;
|
||||
background-color: var(--b3-theme-background);
|
||||
align-items: center;
|
||||
min-width: 204px;
|
||||
overflow: auto;
|
||||
|
||||
.b3-list-item {
|
||||
width: 204px;
|
||||
white-space: nowrap;
|
||||
font-size: 17px;
|
||||
color: var(--b3-theme-on-surface);
|
||||
|
|
|
|||
|
|
@ -159,42 +159,44 @@ export const getDockByType = (type: TDock | string) => {
|
|||
|
||||
export const newCenterEmptyTab = (app: App) => {
|
||||
return new Tab({
|
||||
panel: `<div class="layout__empty b3-list">
|
||||
<div class="${!window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<div class="config-about__logo">
|
||||
<img src="/stage/icon.png">
|
||||
${window.siyuan.languages.siyuanNote}
|
||||
panel: `<div class="layout__empty">
|
||||
<div class="${!window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<div class="config-about__logo">
|
||||
<img src="/stage/icon.png">
|
||||
${window.siyuan.languages.siyuanNote}
|
||||
</div>
|
||||
<div class="b3-label__text">${window.siyuan.languages.slogan}</div>
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="b3-list" style="margin: 0 auto">
|
||||
<div class="b3-list-item" id="editorEmptySearch">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconSearch"></use></svg>
|
||||
<span>${window.siyuan.languages.search}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.globalSearch.custom)}</span>
|
||||
</div>
|
||||
<div id="editorEmptyRecent" class="b3-list-item">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconList"></use></svg>
|
||||
<span>${window.siyuan.languages.recentDocs}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.recentDocs.custom)}</span>
|
||||
</div>
|
||||
<div id="editorEmptyHistory" class="b3-list-item${window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconHistory"></use></svg>
|
||||
<span>${window.siyuan.languages.dataHistory}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.dataHistory.custom)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item${window.siyuan.config.readonly ? " fn__none" : ""}" id="editorEmptyFile">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg>
|
||||
<span>${window.siyuan.languages.newFile}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.newFile.custom)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item${window.siyuan.config.readonly ? " fn__none" : ""}" id="editorEmptyNewNotebook">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconFilesRoot"></use></svg>
|
||||
<span>${window.siyuan.languages.newNotebook}</span>
|
||||
</div>
|
||||
<div class="b3-list-item${(isIPad() || window.siyuan.config.readonly) ? " fn__none" : ""}" id="editorEmptyHelp">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconHelp"></use></svg>
|
||||
<span>${window.siyuan.languages.userGuide}</span>
|
||||
</div>
|
||||
<div class="b3-label__text">${window.siyuan.languages.slogan}</div>
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<div class="b3-list-item" id="editorEmptySearch">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconSearch"></use></svg>
|
||||
<span>${window.siyuan.languages.search}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.globalSearch.custom)}</span>
|
||||
</div>
|
||||
<div id="editorEmptyRecent" class="b3-list-item">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconList"></use></svg>
|
||||
<span>${window.siyuan.languages.recentDocs}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.recentDocs.custom)}</span>
|
||||
</div>
|
||||
<div id="editorEmptyHistory" class="b3-list-item${window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconHistory"></use></svg>
|
||||
<span>${window.siyuan.languages.dataHistory}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.dataHistory.custom)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item${window.siyuan.config.readonly ? " fn__none" : ""}" id="editorEmptyFile">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg>
|
||||
<span>${window.siyuan.languages.newFile}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.newFile.custom)}</span>
|
||||
</div>
|
||||
<div class="b3-list-item${window.siyuan.config.readonly ? " fn__none" : ""}" id="editorEmptyNewNotebook">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconFilesRoot"></use></svg>
|
||||
<span>${window.siyuan.languages.newNotebook}</span>
|
||||
</div>
|
||||
<div class="b3-list-item${(isIPad() || window.siyuan.config.readonly) ? " fn__none" : ""}" id="editorEmptyHelp">
|
||||
<svg class="b3-list-item__graphic"><use xlink:href="#iconHelp"></use></svg>
|
||||
<span>${window.siyuan.languages.userGuide}</span>
|
||||
</div>
|
||||
</div>`,
|
||||
callback(tab: Tab) {
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue