From 90f3c1db578cc8cfa4305cb5e2537a7fc2033e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Wed, 11 Sep 2024 12:09:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#898=20=E4=BF=AE=E5=A4=8D=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BB=A3=E7=A0=81=E5=9D=97=E4=B8=BB=E9=A2=98=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Cherry.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Cherry.js b/src/Cherry.js index 3d962817..93ee1341 100644 --- a/src/Cherry.js +++ b/src/Cherry.js @@ -545,9 +545,12 @@ export default class Cherry extends CherryStatic { } // @ts-ignore if (typeof this.options.engine.syntax.codeBlock.theme === 'string') { - inlineCodeTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.codeBlock).theme; + codeBlockTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.codeBlock).theme; } else { - inlineCodeTheme = this.options.themeSettings.codeBlockTheme; + codeBlockTheme = this.options.themeSettings.codeBlockTheme; + } + if (testHasLocal(this.nameSpace, 'codeTheme')) { + codeBlockTheme = getCodeThemeFromLocal(this.nameSpace); } if (codeBlockTheme === 'dark') codeBlockTheme = 'tomorrow-night'; else if (codeBlockTheme === 'light') codeBlockTheme = 'solarized-light'; @@ -556,9 +559,6 @@ export default class Cherry extends CherryStatic { 'data-inlineCodeTheme': inlineCodeTheme, 'data-codeBlockTheme': codeBlockTheme, }); - - wrapperDom.setAttribute('data-code-block-theme', getCodeThemeFromLocal(this.nameSpace)); - this.wrapperDom = wrapperDom; return wrapperDom; }