Cherry pick of config changes

This commit is contained in:
Knut Sveidqvist
2020-08-14 07:34:42 +02:00
parent a97cc62d0a
commit 129b3f9004
4 changed files with 37 additions and 3 deletions

View File

@@ -220,7 +220,7 @@ const render = function(id, _txt, cb, container) {
// console.warn('Render fetching config');
const cnf = configApi.getConfig();
console.warn('Render with config after adding new directives', cnf.themeVariables.primaryColor);
console.warn('Render with config after adding new directives', cnf.fontFamily);
// Check the maximum allowed text size
if (_txt.length > cnf.maxTextSize) {
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
@@ -553,6 +553,18 @@ function reinitialize() {
function initialize(options) {
console.warn(`mermaidAPI.initialize: v${pkg.version} `, options);
// Handle legacy location of font-family configuration
// console.warn('Conf - ', options.themeVariables.fontFamily);
if (options.fontFamily) {
if (!options.themeVariables) {
options.themeVariables = { fontFamily: options.fontFamily };
} else {
if (!options.themeVariables.fontFamily) {
options.themeVariables = { fontFamily: options.fontFamily };
}
}
}
// Set default options
if (options && options.theme && theme[options.theme]) {