Allow customizing mermaid configuration

This commit is contained in:
Alexander Meindl 2020-12-27 17:21:33 +01:00
parent 66c6631400
commit 50f6d78ff1
3 changed files with 18 additions and 6 deletions

View File

@ -14,6 +14,7 @@ Changelog
- gemify plugin to use it with Gemfile.local or other plugins
- remove spam protection functionality
- Chart.js 2.9.4 support
- Allow overwrite mermaid theme and variables
3.0.0
+++++

View File

@ -1,7 +1,7 @@
' Need Help? :
= link_to(l(:label_additionals_doc),
'https://additionals.readthedocs.io/en/latest/',
= link_to l(:label_additionals_doc), 'https://additionals.readthedocs.io/en/latest/',
class: 'external',
target: '_blank',
rel: 'noopener')
rel: 'noopener'
= render_tabs additionals_settings_tabs

View File

@ -1,5 +1,16 @@
$(function() {
mermaid.initialize({ startOnLoad: true,
theme: 'default',
themeVariables: { 'fontSize': '12px' } });
if (globalThis !== undefined && globalThis.mermaidTheme !== undefined) {
var mermaidTheme = globalThis.mermaidTheme;
} else {
var mermaidTheme = 'default';
}
if (globalThis !== undefined && globalThis.mermaidThemeVariables !== undefined) {
var mermaidThemeVariables = globalThis.mermaidThemeVariables;
} else {
var mermaidThemeVariables = { 'fontSize': '12px' };
}
mermaid.initialize({
startOnLoad: true,
theme: mermaidTheme,
themeVariables: mermaidThemeVariables });
});