🎨 Clean code

This commit is contained in:
Daniel 2024-04-16 09:01:56 +08:00
parent 26984f39df
commit 94d3ccfa9f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
12 changed files with 39 additions and 39 deletions

View file

@ -160,7 +160,7 @@ export const openOutline = async (protyle: IProtyle) => {
}
}), false, false);
newWnd.element.style.width = "200px";
newWnd.element.classList.remove("fn__flex-1")
newWnd.element.classList.remove("fn__flex-1");
switchWnd(newWnd, wnd);
fixWndFlex1(newWnd.parent);
saveLayout();

View file

@ -910,7 +910,7 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
export const fixWndFlex1 = (layout: Layout) => {
if (layout.children.length < 2) {
return
return;
}
if (layout.children[layout.children.length - 2].element.classList.contains("fn__flex-1")) {
return;
@ -919,27 +919,27 @@ export const fixWndFlex1 = (layout: Layout) => {
if (index !== layout.children.length - 2) {
if (layout.direction === "lr") {
if (item.element.classList.contains("fn__flex-1")) {
item.element.style.width = item.element.clientWidth + "px"
item.element.classList.remove("fn__flex-1")
item.element.style.width = item.element.clientWidth + "px";
item.element.classList.remove("fn__flex-1");
}
} else {
if (item.element.classList.contains("fn__flex-1")) {
item.element.style.height = item.element.clientHeight + "px"
item.element.classList.remove("fn__flex-1")
item.element.style.height = item.element.clientHeight + "px";
item.element.classList.remove("fn__flex-1");
}
}
}
})
const flex1Element = layout.children[layout.children.length - 2].element
});
const flex1Element = layout.children[layout.children.length - 2].element;
if (layout.direction === "lr") {
if (flex1Element.style.width) {
flex1Element.style.width = ""
flex1Element.classList.add("fn__flex-1")
flex1Element.style.width = "";
flex1Element.classList.add("fn__flex-1");
}
} else {
if (flex1Element.style.height) {
flex1Element.style.height = ""
flex1Element.classList.add("fn__flex-1")
flex1Element.style.height = "";
flex1Element.classList.add("fn__flex-1");
}
}
}
};