Fix detection of mermaid objects

This commit is contained in:
Cotes Chung 2020-12-11 02:20:18 +08:00
parent 63f57fbc12
commit 289ce1263d
2 changed files with 3 additions and 4 deletions

View file

@ -16,7 +16,6 @@
theme: initTheme /* <default|dark|forest|neutral> */ theme: initTheme /* <default|dark|forest|neutral> */
}; };
/* Markdown converts to HTML */ /* Markdown converts to HTML */
$("pre").has("code.language-mermaid").each(function() { $("pre").has("code.language-mermaid").each(function() {
let svgCode = $(this).children().html(); let svgCode = $(this).children().html();

View file

@ -17,8 +17,8 @@
static get LIGHT_MODE() { return "light"; } static get LIGHT_MODE() { return "light"; }
constructor() { constructor() {
if (this.mode != null) { if (this.hasMode) {
if (this.mode == ModeToggle.DARK_MODE) { if (this.isDarkMode) {
if (!this.isSysDarkPrefer) { if (!this.isSysDarkPrefer) {
this.setDark(); this.setDark();
} }
@ -92,7 +92,7 @@
} }
updateMermaid() { updateMermaid() {
if (mermaid !== undefined) { if (typeof mermaid !== "undefined") {
let expectedTheme = (this.modeStatus === ModeToggle.DARK_MODE? "dark" : "default"); let expectedTheme = (this.modeStatus === ModeToggle.DARK_MODE? "dark" : "default");
let config = { theme: expectedTheme }; let config = { theme: expectedTheme };