浏览代码

:sparkles: https://github.com/siyuan-note/siyuan/issues/4042

Vanessa 2 年之前
父节点
当前提交
f749a89abc
共有 2 个文件被更改,包括 12 次插入6 次删除
  1. 4 0
      app/src/protyle/header/Title.ts
  2. 8 6
      app/src/protyle/util/onGet.ts

+ 4 - 0
app/src/protyle/header/Title.ts

@@ -360,6 +360,10 @@ ${window.siyuan.languages.createdAt} ${dayjs(response.data.ial.id.substr(0, 14))
                 range.selectNodeContents(this.editElement);
                 range.selectNodeContents(this.editElement);
                 focusByRange(range);
                 focusByRange(range);
             }
             }
+            const loadingElement = protyle.element.querySelector(".fn__loading");
+            if (loadingElement) {
+                loadingElement.remove();
+            }
             if (scrollAttr) {
             if (scrollAttr) {
                 restoreScroll(protyle, scrollAttr === Constants.CB_GET_SCROLL ? undefined : scrollAttr);
                 restoreScroll(protyle, scrollAttr === Constants.CB_GET_SCROLL ? undefined : scrollAttr);
             }
             }

+ 8 - 6
app/src/protyle/util/onGet.ts

@@ -17,10 +17,6 @@ import {preventScroll} from "../scroll/preventScroll";
 import {restoreScroll} from "../scroll/saveScroll";
 import {restoreScroll} from "../scroll/saveScroll";
 
 
 export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[] = [], scrollAttr?: string) => {
 export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[] = [], scrollAttr?: string) => {
-    const loadingElement = protyle.element.querySelector(".fn__loading");
-    if (loadingElement) {
-        loadingElement.remove();
-    }
     protyle.wysiwyg.element.removeAttribute("data-top");
     protyle.wysiwyg.element.removeAttribute("data-top");
     if (data.code === 1) {
     if (data.code === 1) {
         // 其他报错
         // 其他报错
@@ -97,8 +93,14 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]
         action,
         action,
     }, protyle);
     }, protyle);
 
 
-    if (scrollAttr && ((protyle.options.render.title && protyle.title.editElement.getAttribute("data-render") === "true") || !protyle.options.render.title)) {
-        restoreScroll(protyle, scrollAttr);
+    if ((protyle.options.render.title && protyle.title.editElement.getAttribute("data-render") === "true") || !protyle.options.render.title) {
+        const loadingElement = protyle.element.querySelector(".fn__loading");
+        if (loadingElement) {
+            loadingElement.remove();
+        }
+        if (scrollAttr) {
+            restoreScroll(protyle, scrollAttr);
+        }
     }
     }
 };
 };