From e9bddf922477a47390e47f8b1a2342385c468332 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 13 Dec 2024 11:14:42 +0800 Subject: [PATCH] :art: --- app/src/protyle/util/destroy.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/protyle/util/destroy.ts b/app/src/protyle/util/destroy.ts index 6c22d91df..a635e3ab7 100644 --- a/app/src/protyle/util/destroy.ts +++ b/app/src/protyle/util/destroy.ts @@ -1,14 +1,17 @@ import {hideElements} from "../ui/hideElements"; +import {isSupportCSSHL} from "../render/searchMarkRender"; export const destroy = (protyle: IProtyle) => { if (!protyle) { return; } hideElements(["util"], protyle); - protyle.highlight.markHL.clear(); - protyle.highlight.mark.clear(); - protyle.highlight.ranges = []; - protyle.highlight.rangeIndex = 0; + if (isSupportCSSHL()) { + protyle.highlight.markHL.clear(); + protyle.highlight.mark.clear(); + protyle.highlight.ranges = []; + protyle.highlight.rangeIndex = 0; + } protyle.observer?.disconnect(); protyle.observerLoad?.disconnect(); protyle.element.classList.remove("protyle");