From 578f74466fcbf2dca537859e73064bfb4583928a Mon Sep 17 00:00:00 2001 From: Ilmari Lauhakangas Date: Thu, 2 May 2019 19:14:02 +0200 Subject: [PATCH] tdf#122366 Store search filter value in sessionStorage sessionStorage seems to be reset, when we change the module context. If this is not acceptable, we can try localStorage. Change-Id: I5ec2ff526e48dd2c7d1889578e991833e43f76c6 Reviewed-on: https://gerrit.libreoffice.org/71688 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- help3xsl/help.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/help3xsl/help.js b/help3xsl/help.js index 2767b157f8..1e92f6ef99 100644 --- a/help3xsl/help.js +++ b/help3xsl/help.js @@ -81,6 +81,17 @@ function debounce(fn, wait) { } search.addEventListener('keyup', debounce(filter, 100)); +// Preserve search input value during the session +search.value = sessionStorage.getItem('searchsave'); + +if (search.value !== undefined) { + filter(); +} + +window.addEventListener('unload', function(event) { + sessionStorage.setItem('searchsave', search.value); +}); + // copy pycode and bascode to clipboard on mouse click // Show border when copy is done divcopyable(document.getElementsByClassName("bascode"));