From 2729a80d550c443426e68642dae1fffeea1905c4 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 2 Nov 2017 18:53:02 +0100 Subject: [PATCH] wip #1771 @0.5 --- js/libs/fluidbook/fluidbook.search.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index 4e34127e..0cb2bde3 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -20,6 +20,14 @@ FluidbookSearch.prototype = { $this.clearHighlights(); return true; }); + + $(document).on('keyup', '#q', function () { + if ($(this).val() == '') { + $this.setHighlightTerms([]); + $this.clearHighlights(); + } + return true; + }); }, getHints: function (q, callback) { var $this = this; @@ -376,9 +384,11 @@ FluidbookSearch.prototype = { // Clear search query and close search related menu items closeSearch: function () { $('#q').val(''); // Clear search field + this.clearHighlights(); + this.setHighlightTerms([]); + this.hideSearchHints(); this.hideSearchResults(); - this.clearHighlights() this.fluidbook.showMenuItems(); // Show menu items that were hidden previously }, @@ -393,8 +403,6 @@ FluidbookSearch.prototype = { this.find(q, function (results) { $this.openResults(results); }); - - }, openResults: function (results) { -- 2.39.5