diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 318faf604..6e9f806d4 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -51,6 +51,7 @@ import {getUnRefList, openSearchUnRef, unRefMoreMenu} from "./unRef"; import {getDefaultType} from "./getDefault"; import {isSupportCSSHL, searchMarkRender} from "../protyle/render/searchMarkRender"; import {saveKeyList, toggleAssetHistory, toggleReplaceHistory, toggleSearchHistory} from "./toggleHistory"; +import {highlightById} from "../util/highlightById"; export const openGlobalSearch = (app: App, text: string, replace: boolean, searchData?: Config.IUILayoutTabSearchConfig) => { text = text.trim(); @@ -1101,6 +1102,8 @@ export const getArticle = (options: { searchMarkRender(options.edit.protyle, getResponse.data.keywords, options.id, () => { if (options.edit.protyle.highlight.ranges.length > 0 && options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex]) { options.edit.protyle.contentElement.scrollTop = options.edit.protyle.contentElement.scrollTop + options.edit.protyle.highlight.ranges[options.edit.protyle.highlight.rangeIndex].getBoundingClientRect().top - contentRect.top - contentRect.height / 2; + } else { + highlightById(options.edit.protyle, options.id); } }); } else {