mermaid: remove console warnings in IE11 #308

This commit is contained in:
Sören Weber 2022-07-17 19:52:23 +02:00
parent 8f6e091a65
commit 8f59c36e10
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 12 additions and 4 deletions

View file

@ -18,6 +18,10 @@
{{- end }}
<script>
function useMathJax( config ){
if( !Object.assign ){
// We don't support MathJax for IE11 anyways, so bail out early
return;
}
window.MathJax = Object.assign( window.MathJax || {}, {
loader: {
load: ['[tex]/mhchem']

View file

@ -896,6 +896,10 @@ jQuery.fn.highlight = function(words, options) {
};
function useMermaid( config ){
if( !Object.assign ){
// We don't support Mermaid for IE11 anyways, so bail out early
return;
}
if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') {
mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, config ) );
if( config.theme && variants ){
@ -904,8 +908,8 @@ function useMermaid( config ){
}
}
}
if( themeUseMermaid ){
useMermaid( themeUseMermaid );
if( window.themeUseMermaid ){
useMermaid( window.themeUseMermaid );
}
function useSwagger( config ){
@ -914,6 +918,6 @@ function useSwagger( config ){
write_style.setProperty( '--CONFIG-SWAGGER-theme', config.theme );
}
}
if( themeUseSwagger ){
useSwagger( themeUseSwagger );
if( window.themeUseSwagger ){
useSwagger( window.themeUseSwagger );
}