|
@@ -18,7 +18,7 @@
|
|
var lastTerm = '';
|
|
var lastTerm = '';
|
|
var returnedFunction = debounce(function (elem) {
|
|
var returnedFunction = debounce(function (elem) {
|
|
let term = elem.val();
|
|
let term = elem.val();
|
|
- if (!!term && lastTerm !== term) {
|
|
|
|
|
|
+ if (!!term) {
|
|
let ep = $(elem).attr('stag-suggest-ep');
|
|
let ep = $(elem).attr('stag-suggest-ep');
|
|
$.get(ep + '?term=' + $.trim(term), function (_data) {
|
|
$.get(ep + '?term=' + $.trim(term), function (_data) {
|
|
|
|
|
|
@@ -209,6 +209,10 @@
|
|
.off('mousedown.stag-suggest-outer-click')
|
|
.off('mousedown.stag-suggest-outer-click')
|
|
.on('mousedown.stag-suggest-outer-click', function (_e) {
|
|
.on('mousedown.stag-suggest-outer-click', function (_e) {
|
|
let elem = $(_e.target);
|
|
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(!elem.is('.stag-suggestions-container') && !elem.closest('.stag-suggestions-container').length) {
|
|
if($('.stag-suggestions-container .suggestions-outer:not(.d-none)').length) {
|
|
if($('.stag-suggestions-container .suggestions-outer:not(.d-none)').length) {
|
|
$('.stag-suggestions-container .suggestions-outer').addClass('d-none');
|
|
$('.stag-suggestions-container .suggestions-outer').addClass('d-none');
|