Forráskód Böngészése

:bug: 当前页签没有激活时编辑器没有初始化

Vanessa 3 éve
szülő
commit
bf2bd552ff
1 módosított fájl, 7 hozzáadás és 2 törlés
  1. 7 2
      app/src/layout/util.ts

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

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