mirror of
https://github.com/McShelby/hugo-theme-relearn
synced 2025-04-30 17:48:47 +08:00
mermaid: rerender graph if search term is present and variant is switched #460
This commit is contained in:
parent
973e95af07
commit
8f4d9f4930
@ -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 ){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user