瀏覽代碼

:bug: fix https://github.com/siyuan-note/siyuan/issues/5615

Vanessa 2 年之前
父節點
當前提交
badfd65f2a
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      app/src/layout/util.ts

+ 5 - 2
app/src/layout/util.ts

@@ -414,9 +414,12 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
         if (layout.model) {
             json.children = {};
             layoutToJSON(layout.model, json.children);
-        } else {
+        } else if (layout.headElement) {
             // 当前页签没有激活时编辑器没有初始化
-            json.children = JSON.parse(layout.headElement.getAttribute("data-initdata")||"{}");
+            json.children = JSON.parse(layout.headElement.getAttribute("data-initdata") || "{}");
+        } else {
+            // 关闭所有页签
+            json.children = {};
         }
     }
 };