Skip to content

Commit 8f4d9f4

Browse files
committed
mermaid: rerender graph if search term is present and variant is switched matcornic#460
1 parent 973e95a commit 8f4d9f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

static/js/theme.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,21 @@ function initMermaid( update, attrs ) {
216216
attrs = attrs || {
217217
'theme': variants.getColorValue( 'MERMAID-theme' ),
218218
};
219+
220+
var search;
221+
if( update ){
222+
search = sessionStorage.getItem( baseUriFull+'search-value' );
223+
unmark();
224+
}
219225
var is_initialized = ( update ? update_func( attrs ) : init_func( attrs ) );
220226
if( is_initialized ){
221227
mermaid.init();
222228
$(".mermaid svg").svgPanZoom({});
223229
}
230+
if( update && search && search.length ){
231+
sessionStorage.setItem( baseUriFull+'search-value', search );
232+
mark();
233+
}
224234
}
225235

226236
function initSwagger( update, attrs ){

0 commit comments

Comments
 (0)