From 476547cfcd6dc52d286a9db5658a4c0f3bc16600 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 29 Nov 2024 07:45:56 +0800 Subject: [PATCH] :rotating_light: --- app/src/protyle/util/reload.ts | 2 +- app/src/search/util.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.ts index 9d7f0b657..da93e197f 100644 --- a/app/src/protyle/util/reload.ts +++ b/app/src/protyle/util/reload.ts @@ -61,7 +61,7 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean, updateReadonly? updateReadonly, cb () { if (protyle.query?.key) { - highlightMark(protyle, protyle.wysiwyg.element.querySelectorAll(`span[data-type~="search-mark"]`)); + highlightMark(protyle, protyle.wysiwyg.element.querySelectorAll('span[data-type~="search-mark"]')); } } }); diff --git a/app/src/search/util.ts b/app/src/search/util.ts index f57611895..5325447ea 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -1167,11 +1167,11 @@ const renderNextSearchMark = (options: { if (options.edit.protyle.highlight.rangeIndex >= options.edit.protyle.highlight.ranges.length) { options.edit.protyle.highlight.rangeIndex = 0; } - let rangeTop + let rangeTop; options.edit.protyle.highlight.ranges.forEach((item, index) => { if (options.edit.protyle.highlight.rangeIndex === index) { options.edit.protyle.highlight.markHL.add(item); - rangeTop = item.getBoundingClientRect().top + rangeTop = item.getBoundingClientRect().top; } else { options.edit.protyle.highlight.mark.add(item); } @@ -1237,7 +1237,7 @@ export const getArticle = (options: { return; } const contentRect = options.edit.protyle.contentElement.getBoundingClientRect(); - let matchRectTop: number + let matchRectTop: number; if (CSS.highlights) { options.edit.protyle.highlight.rangeIndex = 0; highlightMark(options.edit.protyle, matchElements); @@ -1513,8 +1513,8 @@ export const highlightMark = (protyle: IProtyle, matchElements: NodeListOf { const range = new Range(); if (item.getAttribute("data-type") === "search-mark") { - const contentElement = item.firstChild - item.replaceWith(contentElement) + const contentElement = item.firstChild; + item.replaceWith(contentElement); range.selectNodeContents(contentElement); } else { item.setAttribute("data-type", item.getAttribute("data-type").replace(" search-mark", "").replace("search-mark ", "")); @@ -1525,8 +1525,8 @@ export const highlightMark = (protyle: IProtyle, matchElements: NodeListOf