Explorar el Código

Stag suggest disappearance fix

Vijayakrishnan hace 3 años
padre
commit
31248827b2
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      public/js/stag-suggest.js

+ 5 - 1
public/js/stag-suggest.js

@@ -18,7 +18,7 @@
         var lastTerm = '';
         var returnedFunction = debounce(function (elem) {
             let term = elem.val();
-            if (!!term && lastTerm !== term) {
+            if (!!term) {
                 let ep = $(elem).attr('stag-suggest-ep');
                 $.get(ep + '?term=' + $.trim(term), function (_data) {
 
@@ -209,6 +209,10 @@
             .off('mousedown.stag-suggest-outer-click')
             .on('mousedown.stag-suggest-outer-click', function (_e) {
                 let elem = $(_e.target);
+                // if mousedown is on the input whose stag-suggest is on display, ignore
+                if(elem.is('[stag-suggest]') && elem.next('.stag-suggestions-container').find('>.suggestions-outer').is(':visible')) {
+                    return false;
+                }
                 if(!elem.is('.stag-suggestions-container') && !elem.closest('.stag-suggestions-container').length) {
                     if($('.stag-suggestions-container .suggestions-outer:not(.d-none)').length) {
                         $('.stag-suggestions-container .suggestions-outer').addClass('d-none');