From 2ffec98b719fde2a7a8ca3da2e3e4da2f4ee9f5a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 18 Jan 2023 11:31:54 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/7103 --- app/src/search/util.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/search/util.ts b/app/src/search/util.ts index a2907255c..01be43469 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -1075,6 +1075,7 @@ const getArticle = (options: { onGet(getResponse, options.edit.protyle, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_HTML]); const matchElement = options.edit.protyle.wysiwyg.element.querySelector(`div[data-node-id="${options.id}"] span[data-type="search-mark"]`); if (matchElement) { + 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; } });