Jelajahi Sumber

fix Vanessa219#1606 (#1607)

lz6060788 1 tahun lalu
induk
melakukan
a9a4633d86
2 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 1 1
      src/ts/markdown/highlightRender.ts
  2. 1 1
      src/ts/ui/setCodeTheme.ts

+ 1 - 1
src/ts/markdown/highlightRender.ts

@@ -14,7 +14,7 @@ export const highlightRender = (hljsOption?: IHljs, element: HTMLElement | Docum
     }
     const vditorHljsStyle = document.getElementById("vditorHljsStyle") as HTMLLinkElement;
     const href = `${cdn}/dist/js/highlight.js/styles/${style}.css`;
-    if (vditorHljsStyle && vditorHljsStyle.href !== href) {
+    if (vditorHljsStyle && vditorHljsStyle.getAttribute('href') !== href) {
         vditorHljsStyle.remove();
     }
     addStyle(`${cdn}/dist/js/highlight.js/styles/${style}.css`, "vditorHljsStyle");

+ 1 - 1
src/ts/ui/setCodeTheme.ts

@@ -9,7 +9,7 @@ export const setCodeTheme = (codeTheme: string, cdn = Constants.CDN) => {
     const href = `${cdn}/dist/js/highlight.js/styles/${codeTheme}.css`;
     if (!vditorHljsStyle) {
         addStyle(href, "vditorHljsStyle");
-    } else if (vditorHljsStyle.href !== href) {
+    } else if (vditorHljsStyle.getAttribute('href') !== href) {
         vditorHljsStyle.remove();
         addStyle(href, "vditorHljsStyle");
     }