Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16429

Vanessab0f674d84ca8
diff --git a/app/src/util/highlightById.ts b/app/src/util/highlightById.ts
index 7f4cd9259f..1ef92d030a 100644
--- a/app/src/util/highlightById.ts
+++ b/app/src/util/highlightById.ts
@@ -111,14 +111,15 @@ export const scrollCenter = (
}
if (position === "nearest") {
// 在可视区域内不进行滚动
- if (elementRect.top < contentRect.top) {
+ if (elementRect.bottom < contentRect.top) {
protyle.contentElement.scroll({
top: protyle.contentElement.scrollTop + elementRect.top - contentRect.top,
behavior
});
- } else if (elementRect.bottom > contentRect.bottom) {
+ } else if (elementRect.top > contentRect.bottom) {
protyle.contentElement.scroll({
- top: protyle.contentElement.scrollTop + elementRect.bottom - contentRect.bottom,
+ top: elementRect.height > contentRect.height ? protyle.contentElement.scrollTop + elementRect.top - contentRect.top :
+ protyle.contentElement.scrollTop + elementRect.bottom - contentRect.bottom,
behavior
});
}