From f3c067bf9bfc1b11098eb5bff13520f8b22b1aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Wed, 3 Nov 2021 21:42:38 +0100 Subject: [PATCH] mermaid: assert that window.mermaid is actually mermaid #136 --- layouts/partials/footer.html | 2 +- static/js/relearn.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 047afe0d55..b477563650 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -42,7 +42,7 @@ {{- $.Scratch.Set "mermaidInitialize" "{ \"startOnLoad\": true }" }} {{- end }} diff --git a/static/js/relearn.js b/static/js/relearn.js index 599c0e6b44..b229375315 100644 --- a/static/js/relearn.js +++ b/static/js/relearn.js @@ -104,7 +104,7 @@ function initMermaid() { $(element).parent().replaceWith('
' + content + '
'); }); - if (typeof mermaid != 'undefined') { + if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') { mermaid.mermaidAPI.initialize( Object.assign( {}, mermaid.mermaidAPI.getSiteConfig(), { startOnLoad: true } ) ); mermaid.contentLoaded(); $(".mermaid svg").svgPanZoom({})