#1542 Making sure user overrides from directives ocerrides properly

This commit is contained in:
Knut Sveidqvist
2020-07-19 15:02:53 +02:00
parent 8a018aa0f2
commit 4d280ff010
11 changed files with 561 additions and 273 deletions

View File

@@ -54,7 +54,7 @@ import getStyles from './styles';
const themes = {};
for (const themeName of ['default', 'forest', 'dark', 'neutral']) {
themes[themeName] = require(`./theme-${themeName}.js`);
themes[themeName] = require(`./themes/theme-${themeName}.js`);
}
function parse(text) {
@@ -522,7 +522,7 @@ function reinitialize(options) {
console.warn(`mermaidAPI.reinitialize: v${pkg.version}`, options);
if (options.theme && themes[options.theme]) {
// Todo merge with user options
options.themeVariables = themes[options.theme];
options.themeVariables = themes[options.theme].getThemeVariables(options.themeVariables);
}
// Set default options
@@ -538,7 +538,7 @@ function initialize(options) {
if (options && options.theme && themes[options.theme]) {
// Todo merge with user options
options.themeVariables = themes[options.theme];
options.themeVariables = themes[options.theme].getThemeVariables(options.themeVariables);
} else {
if (options) options.themeVariables = themes.default;
}