]> _ Git - fluidbook-html5.git/commitdiff
wip #1771 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Nov 2017 17:53:02 +0000 (18:53 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Nov 2017 17:53:02 +0000 (18:53 +0100)
js/libs/fluidbook/fluidbook.search.js

index 4e34127eaa7ef12e2b746114741938f12619a074..0cb2bde313e9b1307e8f2b93435df34732cf22a5 100644 (file)
@@ -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) {