From b2b527756b5d676c5d14596ad6cabfd1347047a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sat, 5 Aug 2023 14:10:41 +0200 Subject: [PATCH] mermaid: in doubt, set variants mermaid theme into yaml #603 #601 --- static/js/theme.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/static/js/theme.js b/static/js/theme.js index dbfa83b350..0791ad1220 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -196,20 +196,14 @@ function initMermaid( update, attrs ) { document.querySelectorAll('.mermaid').forEach( function( element ){ var parse = parseGraph( decodeHTML( element.innerHTML ) ); - if( JSON.stringify(parse.dir) === '{}' ){ - if( parse.yaml.theme ){ - parse.yaml.relearn_user_theme = true; - } - if( !parse.yaml.relearn_user_theme ){ - parse.yaml.theme = theme; - } - } else { - if( parse.dir.theme ){ - parse.dir.relearn_user_theme = true; - } - if( !parse.dir.relearn_user_theme ){ - parse.dir.theme = theme; - } + if( parse.yaml.theme ){ + parse.yaml.relearn_user_theme = true; + } + if( parse.dir.theme ){ + parse.dir.relearn_user_theme = true; + } + if( !parse.yaml.relearn_user_theme && !parse.dir.relearn_user_theme ){ + parse.yaml.theme = theme; } is_initialized = true; @@ -239,7 +233,7 @@ function initMermaid( update, attrs ) { } is_initialized = true; - parse.dir.theme = theme; + parse.yaml.theme = theme; var graph = serializeGraph( parse ); element.removeAttribute('data-processed'); element.innerHTML = graph;