From 483ae3b671a1275476a08d946d8a49f7a7e59d1b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 13:10:04 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/10998 --- app/src/layout/Wnd.ts | 11 +++-------- app/src/layout/dock/util.ts | 8 ++++---- app/src/layout/index.ts | 4 +++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index 1b9d56ec9..527a4765a 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -1,6 +1,7 @@ import {Layout} from "./index"; import {genUUID} from "../util/genID"; import { + fixWndFlex1, getInstanceById, getWndByLayout, JSONToCenter, newModelByInitData, pdfIsLoading, saveLayout, @@ -716,7 +717,7 @@ export class Wnd { // 关闭分屏页签后光标消失 const editors = getAllModels().editor; if (editors.length === 0) { - clearOBG(); + clearOBG(); } else { editors.forEach(item => { if (!item.element.classList.contains("fn__none")) { @@ -965,13 +966,6 @@ export class Wnd { } previous.resize = undefined; previous.element.classList.add("fn__flex-1"); - } else if (!previous.element.classList.contains("fn__flex-1")) { - // 分屏后要均分 https://github.com/siyuan-note/siyuan/issues/5657 - if (layout.direction === "lr") { - previous.element.style.width = (previous.element.clientWidth + element.clientWidth) + "px"; - } else { - previous.element.style.height = (previous.element.clientHeight + element.clientHeight) + "px"; - } } // https://github.com/siyuan-note/siyuan/issues/5844 if (layout.children.length > 2 && index === 0) { @@ -988,6 +982,7 @@ export class Wnd { element.nextElementSibling.remove(); } element.remove(); + fixWndFlex1(layout); resizeTabs(); } } diff --git a/app/src/layout/dock/util.ts b/app/src/layout/dock/util.ts index d1b045d77..ef00f181f 100644 --- a/app/src/layout/dock/util.ts +++ b/app/src/layout/dock/util.ts @@ -2,7 +2,7 @@ import {getAllModels} from "../getAll"; import {Tab} from "../Tab"; import {Graph} from "./Graph"; import {Outline} from "./Outline"; -import {getInstanceById, getWndByLayout, saveLayout, switchWnd} from "../util"; +import {fixWndFlex1, getInstanceById, getWndByLayout, saveLayout, switchWnd} from "../util"; import {resizeTabs} from "../tabUtil"; import {Backlink} from "./Backlink"; import {App} from "../../index"; @@ -159,10 +159,10 @@ export const openOutline = async (protyle: IProtyle) => { })); } }), false, false); + newWnd.element.style.width = "200px"; + newWnd.element.classList.remove("fn__flex-1") switchWnd(newWnd, wnd); - // https://github.com/siyuan-note/siyuan/issues/10500 - wnd.element.classList.remove("fn__flex-1"); - wnd.element.style.width = wnd.element.parentElement.clientWidth - 200 + "px"; + fixWndFlex1(newWnd.parent); saveLayout(); }; diff --git a/app/src/layout/index.ts b/app/src/layout/index.ts index 93e8f0b25..ee2dd74fb 100644 --- a/app/src/layout/index.ts +++ b/app/src/layout/index.ts @@ -93,7 +93,9 @@ export class Layout { } }); } - fixWndFlex1(this); + if (id) { + fixWndFlex1(this); + } addResize(child); resizeTabs(false); child.parent = this;