This commit is contained in:
Vanessa 2024-12-13 11:14:42 +08:00
parent 0239b88c43
commit e9bddf9224

View file

@ -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");