Browse Source

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

Vanessa 3 years ago
parent
commit
bf2e2123b7
4 changed files with 9 additions and 9 deletions
  1. 2 2
      app/src/index.ts
  2. 2 2
      app/src/layout/util.ts
  3. 3 3
      app/src/mobile/index.ts
  4. 2 2
      app/src/util/onGetConfig.ts

+ 2 - 2
app/src/index.ts

@@ -84,13 +84,13 @@ class App {
             menus: new Menus()
             menus: new Menus()
         };
         };
         fetchPost("/api/system/getConf", {}, response => {
         fetchPost("/api/system/getConf", {}, response => {
-            window.siyuan.config = response.data;
+            window.siyuan.config = response.data.conf;
             fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
             fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
                 window.siyuan.languages = lauguages;
                 window.siyuan.languages = lauguages;
                 bootSync();
                 bootSync();
                 fetchPost("/api/setting/getCloudUser", {}, userResponse => {
                 fetchPost("/api/setting/getCloudUser", {}, userResponse => {
                     window.siyuan.user = userResponse.data;
                     window.siyuan.user = userResponse.data;
-                    onGetConfig();
+                    onGetConfig(response.data.start);
                     account.onSetaccount();
                     account.onSetaccount();
                     resizeDrag();
                     resizeDrag();
                     setTitle(window.siyuan.languages.siyuanNote);
                     setTitle(window.siyuan.languages.siyuanNote);

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

@@ -269,12 +269,12 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
     }
     }
 };
 };
 
 
-export const JSONToLayout = () => {
+export const JSONToLayout = (isStart: boolean) => {
     JSONToCenter(window.siyuan.config.uiLayout.layout);
     JSONToCenter(window.siyuan.config.uiLayout.layout);
     JSONToDock(window.siyuan.config.uiLayout);
     JSONToDock(window.siyuan.config.uiLayout);
     const allModels = getAllModels();
     const allModels = getAllModels();
     // 启动时不打开页签,需要移除没有钉住的页签
     // 启动时不打开页签,需要移除没有钉住的页签
-    if (window.siyuan.config.fileTree.closeTabsOnStart) {
+    if (window.siyuan.config.fileTree.closeTabsOnStart && isStart) {
         allModels.editor.forEach(item => {
         allModels.editor.forEach(item => {
             if (item.parent.headElement && !item.parent.headElement.classList.contains("item--pin")) {
             if (item.parent.headElement && !item.parent.headElement.classList.contains("item--pin")) {
                 item.parent.parent.removeTab(item.parent.id);
                 item.parent.parent.removeTab(item.parent.id);

+ 3 - 3
app/src/mobile/index.ts

@@ -43,13 +43,13 @@ class App {
             }
             }
         });
         });
         fetchPost("/api/system/getConf", {}, confResponse => {
         fetchPost("/api/system/getConf", {}, confResponse => {
-            confResponse.data.keymap = Constants.SIYUAN_KEYMAP;
-            window.siyuan.config = confResponse.data;
+            confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
+            window.siyuan.config = confResponse.data.conf;
             fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
             fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
                 window.siyuan.languages = lauguages;
                 window.siyuan.languages = lauguages;
                 document.title = window.siyuan.languages.siyuanNote;
                 document.title = window.siyuan.languages.siyuanNote;
                 bootSync();
                 bootSync();
-                loadAssets(confResponse.data.appearance);
+                loadAssets(confResponse.data.conf.appearance);
                 initAssets();
                 initAssets();
                 fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
                 fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
                     window.siyuan.emojis = emojiResponse.data as IEmoji[];
                     window.siyuan.emojis = emojiResponse.data as IEmoji[];

+ 2 - 2
app/src/util/onGetConfig.ts

@@ -92,7 +92,7 @@ export const setProxy = () => {
     /// #endif
     /// #endif
 };
 };
 
 
-export const onGetConfig = () => {
+export const onGetConfig = (isStart:boolean) => {
     const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");
     const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");
     const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general");
     const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general");
     const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert");
     const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert");
@@ -128,7 +128,7 @@ export const onGetConfig = () => {
     fetchPost("/api/system/getEmojiConf", {}, response => {
     fetchPost("/api/system/getEmojiConf", {}, response => {
         window.siyuan.emojis = response.data as IEmoji[];
         window.siyuan.emojis = response.data as IEmoji[];
         try {
         try {
-            JSONToLayout();
+            JSONToLayout(isStart);
         } catch (e) {
         } catch (e) {
             fetchPost("/api/system/setUILayout", {layout: {}}, () => {
             fetchPost("/api/system/setUILayout", {layout: {}}, () => {
                 window.location.reload();
                 window.location.reload();