瀏覽代碼

:art: fix https://github.com/siyuan-note/siyuan/issues/10998

Vanessa 1 年之前
父節點
當前提交
483ae3b671
共有 3 個文件被更改,包括 10 次插入13 次删除
  1. 3 8
      app/src/layout/Wnd.ts
  2. 4 4
      app/src/layout/dock/util.ts
  3. 3 1
      app/src/layout/index.ts

+ 3 - 8
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();
     }
 }

+ 4 - 4
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();
 };
 

+ 3 - 1
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;