Vanessa 2024-01-08 12:39:48 +08:00
parent cfc3fd11e9
commit 339329fb6b

View file

@ -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;
}
// 加强定位