From 339329fb6b96f0efffacba8602f45142e4c14cb6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 8 Jan 2024 12:39:48 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/10108 --- app/src/protyle/util/onGet.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index f41732213..1d0b436da 100644 --- a/app/src/protyle/util/onGet.ts +++ b/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; } // 加强定位