From 289ce1263d2f9621b6a7374a041352293fd401ff Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 11 Dec 2020 02:20:18 +0800 Subject: [PATCH] Fix detection of mermaid objects --- _includes/mermaid.html | 1 - _includes/mode-toggle.html | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/_includes/mermaid.html b/_includes/mermaid.html index 6abef73..2cb5cc6 100644 --- a/_includes/mermaid.html +++ b/_includes/mermaid.html @@ -16,7 +16,6 @@ theme: initTheme /* */ }; - /* Markdown converts to HTML */ $("pre").has("code.language-mermaid").each(function() { let svgCode = $(this).children().html(); diff --git a/_includes/mode-toggle.html b/_includes/mode-toggle.html index 1ae94ec..8d49b28 100644 --- a/_includes/mode-toggle.html +++ b/_includes/mode-toggle.html @@ -17,8 +17,8 @@ static get LIGHT_MODE() { return "light"; } constructor() { - if (this.mode != null) { - if (this.mode == ModeToggle.DARK_MODE) { + if (this.hasMode) { + if (this.isDarkMode) { if (!this.isSysDarkPrefer) { this.setDark(); } @@ -92,7 +92,7 @@ } updateMermaid() { - if (mermaid !== undefined) { + if (typeof mermaid !== "undefined") { let expectedTheme = (this.modeStatus === ModeToggle.DARK_MODE? "dark" : "default"); let config = { theme: expectedTheme };