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/pull/14312

Vanessa626d5ecd32f3
diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts
index 7c3472f6d4..ccaa996819 100644
--- a/app/src/layout/dock/Outline.ts
+++ b/app/src/layout/dock/Outline.ts
@@ -485,12 +485,8 @@ export class Outline extends Model {
}
if (currentElement) {
currentElement.classList.add("b3-list-item--focus");
-
- const targetRect = currentElement.getBoundingClientRect();
- const containerRect = this.element.getBoundingClientRect();
- const relativeTop = targetRect.top - containerRect.top + this.element.scrollTop;
-
- this.element.scrollTop = relativeTop - this.element.clientHeight / 2 - 30;
+ const elementRect = this.element.getBoundingClientRect();
+ this.element.scrollTop = this.element.scrollTop + (currentElement.getBoundingClientRect().top - (elementRect.top + elementRect.height / 2));
}
}