浏览代码

fix Vanessa219#1606 (#1607)

lz6060788 1 年之前
父节点
当前提交
a9a4633d86
共有 2 个文件被更改,包括 2 次插入2 次删除
  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 vditorHljsStyle = document.getElementById("vditorHljsStyle") as HTMLLinkElement;
     const href = `${cdn}/dist/js/highlight.js/styles/${style}.css`;
     const href = `${cdn}/dist/js/highlight.js/styles/${style}.css`;
-    if (vditorHljsStyle && vditorHljsStyle.href !== href) {
+    if (vditorHljsStyle && vditorHljsStyle.getAttribute('href') !== href) {
         vditorHljsStyle.remove();
         vditorHljsStyle.remove();
     }
     }
     addStyle(`${cdn}/dist/js/highlight.js/styles/${style}.css`, "vditorHljsStyle");
     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`;
     const href = `${cdn}/dist/js/highlight.js/styles/${codeTheme}.css`;
     if (!vditorHljsStyle) {
     if (!vditorHljsStyle) {
         addStyle(href, "vditorHljsStyle");
         addStyle(href, "vditorHljsStyle");
-    } else if (vditorHljsStyle.href !== href) {
+    } else if (vditorHljsStyle.getAttribute('href') !== href) {
         vditorHljsStyle.remove();
         vditorHljsStyle.remove();
         addStyle(href, "vditorHljsStyle");
         addStyle(href, "vditorHljsStyle");
     }
     }