소스 검색

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

Vanessa 1 년 전
부모
커밋
339329fb6b
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      app/src/protyle/util/onGet.ts

+ 2 - 1
app/src/protyle/util/onGet.ts

@@ -395,6 +395,8 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
     if (hasScrollTop) {
         protyle.contentElement.scrollTop = scrollAttr.scrollTop;
     }
+    // 下一个请求过来前需断开,否则 observerLoad 重新赋值后无法 disconnect https://ld246.com/article/1704612002446
+    protyle.observerLoad?.disconnect();
     if (action.includes(Constants.CB_GET_FOCUS) || action.includes(Constants.CB_GET_SCROLL) || action.includes(Constants.CB_GET_HL) || action.includes(Constants.CB_GET_FOCUSFIRST)) {
         const contentRect = protyle.contentElement.getBoundingClientRect();
         const focusRect = focusElement.getBoundingClientRect();
@@ -402,7 +404,6 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScr
             scrollCenter(protyle, focusElement, true);
         }
     } else {
-        protyle.observerLoad?.disconnect();
         return;
     }
     // 加强定位