Skip to content

Commit

Permalink
fix: #898 修复配置代码块主题失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Sep 11, 2024
1 parent 191206b commit 90f3c1d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Cherry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;
}
Expand Down

0 comments on commit 90f3c1d

Please sign in to comment.