mermaid: rerender graph if search term is present and variant is switched #460

This commit is contained in:
Sören Weber 2023-02-04 00:07:52 +01:00
parent 973e95af07
commit 8f4d9f4930
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -216,11 +216,21 @@ function initMermaid( update, attrs ) {
attrs = attrs || { attrs = attrs || {
'theme': variants.getColorValue( 'MERMAID-theme' ), 'theme': variants.getColorValue( 'MERMAID-theme' ),
}; };
var search;
if( update ){
search = sessionStorage.getItem( baseUriFull+'search-value' );
unmark();
}
var is_initialized = ( update ? update_func( attrs ) : init_func( attrs ) ); var is_initialized = ( update ? update_func( attrs ) : init_func( attrs ) );
if( is_initialized ){ if( is_initialized ){
mermaid.init(); mermaid.init();
$(".mermaid svg").svgPanZoom({}); $(".mermaid svg").svgPanZoom({});
} }
if( update && search && search.length ){
sessionStorage.setItem( baseUriFull+'search-value', search );
mark();
}
} }
function initSwagger( update, attrs ){ function initSwagger( update, attrs ){