An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: search
Vanessa0a8ea4e1b851
diff --git a/app/src/protyle/render/highlightRender.ts b/app/src/protyle/render/highlightRender.tsindex 80accfb7b9..10db9448f2 100644--- a/app/src/protyle/render/highlightRender.ts+++ b/app/src/protyle/render/highlightRender.ts@@ -102,14 +102,6 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =languageElement.style.marginLeft = "";}}- // 搜索定位- const layoutElement = hasClosestByClassName(block, "search__layout", true);- if (layoutElement && block.parentElement.getAttribute("data-node-id") === layoutElement.querySelector("#searchList > .b3-list-item--focus")?.getAttribute("data-node-id")) {- const matchElement = block.querySelector('span[data-type="search-mark"]');- if (matchElement) {- matchElement.scrollIntoView();- }- }block.innerHTML = window.hljs.highlight(block.textContent + (block.textContent.endsWith("\n") ? "" : "\n"), // https://github.com/siyuan-note/siyuan/issues/4609{diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex 1ea6bd714f..772e098eb8 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -1189,7 +1189,11 @@ export const getArticle = (options: {if (matchElement) {matchElement.classList.add("search-mark--hl");const contentRect = options.edit.protyle.contentElement.getBoundingClientRect();- options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + matchElement.getBoundingClientRect().top - contentRect.top - contentRect.height / 2;+ const matchRectTop = matchElement.getBoundingClientRect().top; // 需前置,否则代码高亮后会移除该元素+ setTimeout(() => {+ // 等待 scrollCenter 定位后再滚动+ options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + matchRectTop - contentRect.top - contentRect.height / 2;+ });}});});