From: Vincent Vanwaelscappel Date: Thu, 2 Nov 2017 17:53:02 +0000 (+0100) Subject: wip #1771 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2729a80d550c443426e68642dae1fffeea1905c4;p=fluidbook-html5.git wip #1771 @0.5 --- 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) {