Merge pull request #4441 from node-red/4274-allow-theme-to-set-mermaid-theme

Allow a theme to specifiy which theme mermaid should use
pull/4448/head
Stephen McLaughlin 2023-11-20 21:43:03 +00:00 committed by GitHub
commit a55554193b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -339,6 +339,8 @@ module.exports = {
} }
theme.codeEditor = theme.codeEditor || {} theme.codeEditor = theme.codeEditor || {}
theme.codeEditor.options = Object.assign({}, themePlugin.monacoOptions, theme.codeEditor.options); theme.codeEditor.options = Object.assign({}, themePlugin.monacoOptions, theme.codeEditor.options);
theme.mermaid = Object.assign({}, themePlugin.mermaid, theme.mermaid)
} }
activeThemeInitialised = true; activeThemeInitialised = true;
} }

View File

@ -15,7 +15,8 @@ RED.editor.mermaid = (function () {
'vendor/mermaid/mermaid.min.js', 'vendor/mermaid/mermaid.min.js',
function (data, stat, jqxhr) { function (data, stat, jqxhr) {
mermaid.initialize({ mermaid.initialize({
startOnLoad: false startOnLoad: false,
theme: RED.settings.get('mermaid', {}).theme
}) })
loaded = true loaded = true
while(pendingEvals.length > 0) { while(pendingEvals.length > 0) {

View File

@ -99,6 +99,9 @@ var api = module.exports = {
safeSettings.markdownEditor = runtime.settings.editorTheme.markdownEditor || {}; safeSettings.markdownEditor = runtime.settings.editorTheme.markdownEditor || {};
safeSettings.markdownEditor.mermaid = safeSettings.markdownEditor.mermaid || { enabled: true }; safeSettings.markdownEditor.mermaid = safeSettings.markdownEditor.mermaid || { enabled: true };
} }
if (runtime.settings.editorTheme.mermaid) {
safeSettings.mermaid = runtime.settings.editorTheme.mermaid
}
} }
safeSettings.libraries = runtime.library.getLibraries(); safeSettings.libraries = runtime.library.getLibraries();
if (util.isArray(runtime.settings.paletteCategories)) { if (util.isArray(runtime.settings.paletteCategories)) {