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/14647

Vanessa04100d7c02cc
diff --git a/app/src/util/highlightById.ts b/app/src/util/highlightById.ts
index 07cb2e5a05..b58c4a1d3f 100644
--- a/app/src/util/highlightById.ts
+++ b/app/src/util/highlightById.ts
@@ -50,10 +50,13 @@ export const scrollCenter = (
if (blockElement) {
// https://github.com/siyuan-note/siyuan/issues/10769
if (blockElement.classList.contains("code-block")) {
+ const hljsElement = blockElement.querySelector(".hljs");
+ const scrollLeft = hljsElement.scrollLeft;
const brElement = document.createElement("br");
range.insertNode(brElement);
brElement.scrollIntoView({block: position, behavior});
brElement.remove();
+ hljsElement.scrollLeft = scrollLeft;
return;
}