mermaid: fix broken zoom since update to v10 #608

This commit is contained in:
Sören Weber 2023-08-07 23:32:38 +02:00
parent 3dada8b058
commit e837822172
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -277,7 +277,8 @@ function initMermaid( update, attrs ) {
var is_initialized = ( update ? update_func( attrs ) : init_func( attrs ) );
if( is_initialized ){
mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, window.relearn.mermaidConfig, { theme: attrs.theme } ) );
mermaid.run();
mermaid.run({
postRenderCallback: function(){
// zoom for Mermaid
// https://github.com/mermaid-js/mermaid/issues/1860#issuecomment-1345440607
var svgs = d3.selectAll( '.mermaid.zoom svg' );
@ -290,6 +291,10 @@ function initMermaid( update, attrs ) {
});
svg.call( zoom );
});
},
querySelector: '.mermaid',
suppressErrors: true
});
}
if( update && search && search.length ){
sessionStorage.setItem( baseUriFull+'search-value', search );