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: https://github.com/siyuan-note/siyuan/issues/13343
Vanessa6a7fb4ad61ea
diff --git a/app/src/protyle/render/searchMarkRender.ts b/app/src/protyle/render/searchMarkRender.tsindex e7aeec82d1..e518cdf02a 100644--- a/app/src/protyle/render/searchMarkRender.ts+++ b/app/src/protyle/render/searchMarkRender.ts@@ -1,6 +1,6 @@import {Constants} from "../../constants";-export const searchMarkRender = (protyle: IProtyle, keys: string[], isHL: boolean) => {+export const searchMarkRender = (protyle: IProtyle, keys: string[], isHL: boolean, cb?: () => void) => {if (!isSupportCSSHL()) {return;}@@ -76,6 +76,9 @@ export const searchMarkRender = (protyle: IProtyle, keys: string[], isHL: booleaif (isHL) {CSS.highlights.set("search-mark-hl-" + protyle.highlight.styleElement.dataset.uuid, protyle.highlight.markHL);}+ if (cb) {+ cb();+ }}, protyle.wysiwyg.element.querySelector(".hljs") ? Constants.TIMEOUT_TRANSITION : 0);};diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex a13e0596f7..5e843de213 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -1236,20 +1236,19 @@ export const getArticle = (options: {});const contentRect = options.edit.protyle.contentElement.getBoundingClientRect();- let matchRectTop: number;if (isSupportCSSHL()) {options.edit.protyle.highlight.rangeIndex = 0;- searchMarkRender(options.edit.protyle, getResponse.data.keywords, true);- matchRectTop = options.edit.protyle.highlight.ranges[0].getBoundingClientRect().top;+ searchMarkRender(options.edit.protyle, getResponse.data.keywords, true, () => {+ options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + options.edit.protyle.highlight.ranges[0].getBoundingClientRect().top - contentRect.top - contentRect.height / 2;+ });} else {const matchElements = options.edit.protyle.wysiwyg.element.querySelectorAll('span[data-type~="search-mark"]');if (matchElements.length === 0) {return;}matchElements[0].classList.add("search-mark--hl");- matchRectTop = matchElements[0].getBoundingClientRect().top;+ options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + matchElements[0].getBoundingClientRect().top - contentRect.top - contentRect.height / 2;}- options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + matchRectTop - contentRect.top - contentRect.height / 2;});});});