Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/src/layout/dock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ export class Dock {

if (activeElements.length === 0) {
this.resizeElement.classList.add("fn__none");
// 如果没有打开的侧栏,隐藏 layout 的子元素
this.layout.children.forEach(child => {
(child as Wnd).element.classList.add("fn__none");
});
if (this.layout.children.length > 1) {
const separatorElement = (this.layout.children[0] as Wnd).element.nextElementSibling;
if (separatorElement) {
separatorElement.classList.add("fn__none");
}
}
} else {
activeElements.forEach(item => {
this.toggleModel(item.getAttribute("data-type") as TDock, true, false, false, false);
Expand Down
13 changes: 12 additions & 1 deletion app/src/layout/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,11 @@ export const addResize = (obj: Layout | Wnd) => {

export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.parent) => {
layout.children.forEach((item: Layout | Wnd) => {
if (item.element.classList.contains("layout__dockl") ||
item.element.classList.contains("layout__dockr")) {
return;
}

item.element.style.maxWidth = "";
if (!item.element.style.width && !item.element.classList.contains("layout__center")) {
item.element.style.minWidth = "8px";
Expand All @@ -982,6 +987,11 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
// +2 由于某些分辨率下 scrollWidth 会大于 clientWidth
while (layout.element.scrollWidth > layout.element.clientWidth + 2 && index > 0) {
layout.children.find((item: Layout | Wnd) => {
if (item.element.classList.contains("layout__dockl") ||
item.element.classList.contains("layout__dockr")) {
return false;
}

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;
Expand All @@ -992,7 +1002,8 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
});
index--;
}
if (lastItem) {
if (lastItem && !lastItem.classList.contains("layout__dockl") &&
!lastItem.classList.contains("layout__dockr")) {
lastItem.style.maxWidth = Math.max(Math.min(lastItem.clientWidth, window.innerWidth) - 8, 64) + "px";
}
layout.children.forEach((item: Layout | Wnd) => {
Expand Down