From 3dada8b05889871c98ee80c4b3959406f2be980e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 7 Aug 2023 22:37:05 +0200 Subject: [PATCH] mermaid: variant generator diagram does not respond to events #607 --- static/js/theme.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/js/theme.js b/static/js/theme.js index 0791ad1220..88a6f92b8b 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -276,7 +276,8 @@ function initMermaid( update, attrs ) { } var is_initialized = ( update ? update_func( attrs ) : init_func( attrs ) ); if( is_initialized ){ - mermaid.init( {theme: attrs.theme} ); + mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, window.relearn.mermaidConfig, { theme: attrs.theme } ) ); + mermaid.run(); // zoom for Mermaid // https://github.com/mermaid-js/mermaid/issues/1860#issuecomment-1345440607 var svgs = d3.selectAll( '.mermaid.zoom svg' ); @@ -1345,6 +1346,7 @@ function useMermaid( config ){ // We don't support Mermaid for IE11 anyways, so bail out early return; } + window.relearn.mermaidConfig = config; if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') { mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, config ) ); if( config.theme && variants ){