From d5dfa240f59054560bf6c2506d0fb5e6c34243b8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 18 Dec 2024 01:44:59 +0800 Subject: [PATCH] :art: search --- app/src/search/util.ts | 3 +++ 1 file changed, 3 insertions(+) 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 {