[Libreoffice-commits] help.git: help3xsl/help.js

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu May 2 18:18:46 UTC 2019


 help3xsl/help.js |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 578f74466fcbf2dca537859e73064bfb4583928a
Author:     Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
AuthorDate: Thu May 2 19:14:02 2019 +0200
Commit:     Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Thu May 2 20:17:50 2019 +0200

    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 <olivier.hallot at libreoffice.org>

diff --git a/help3xsl/help.js b/help3xsl/help.js
index 2767b157f..1e92f6ef9 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"));


More information about the Libreoffice-commits mailing list