From 8f4d9f4930e60ec514f69283eb3120a5c84e0c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sat, 4 Feb 2023 00:07:52 +0100 Subject: [PATCH] mermaid: rerender graph if search term is present and variant is switched #460 --- static/js/theme.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/static/js/theme.js b/static/js/theme.js index 9e54d418e7..ea4ee4cfb3 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -216,11 +216,21 @@ function initMermaid( update, attrs ) { attrs = attrs || { '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 ) ); if( is_initialized ){ mermaid.init(); $(".mermaid svg").svgPanZoom({}); } + if( update && search && search.length ){ + sessionStorage.setItem( baseUriFull+'search-value', search ); + mark(); + } } function initSwagger( update, attrs ){