mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-11 19:39:43 +02:00
Merge pull request #3277 from alguerocode/clean-code-1
code syntax improvment (initialize func)
This commit is contained in:
@@ -491,23 +491,20 @@ function updateRendererConfigs(conf) {
|
|||||||
/** @param {any} options */
|
/** @param {any} options */
|
||||||
function initialize(options) {
|
function initialize(options) {
|
||||||
// Handle legacy location of font-family configuration
|
// Handle legacy location of font-family configuration
|
||||||
if (options && options.fontFamily) {
|
if (options?.fontFamily) {
|
||||||
if (!options.themeVariables) {
|
if (!options.themeVariables?.fontFamily) {
|
||||||
options.themeVariables = { fontFamily: options.fontFamily };
|
options.themeVariables = { fontFamily: options.fontFamily };
|
||||||
} else {
|
|
||||||
if (!options.themeVariables.fontFamily) {
|
|
||||||
options.themeVariables = { fontFamily: options.fontFamily };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set default options
|
// Set default options
|
||||||
configApi.saveConfigFromInitialize(options);
|
configApi.saveConfigFromInitialize(options);
|
||||||
|
|
||||||
if (options && options.theme && theme[options.theme]) {
|
if (options?.theme && theme[options.theme]) {
|
||||||
// Todo merge with user options
|
// Todo merge with user options
|
||||||
options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables);
|
options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables);
|
||||||
} else {
|
} else if (options) {
|
||||||
if (options) options.themeVariables = theme.default.getThemeVariables(options.themeVariables);
|
options.themeVariables = theme.default.getThemeVariables(options.themeVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
const config =
|
const config =
|
||||||
|
Reference in New Issue
Block a user