Add processing flag to keep enter keypress while typing separate from enter keypress to select a result

This commit is contained in:
Nathan Gray 2014-02-24 20:00:34 +00:00
parent f8035b8312
commit 7a35d59f65

View File

@ -678,7 +678,7 @@ var et2_link_entry = et2_inputWidget.extend(
// Bind to enter key to start search early // Bind to enter key to start search early
this.search.keydown(function(e) { this.search.keydown(function(e) {
var keycode = (e.keyCode ? e.keyCode : e.which); var keycode = (e.keyCode ? e.keyCode : e.which);
if(keycode == '13') if(keycode == '13' && !self.processing)
{ {
self.search.autocomplete("option","minLength", 0); self.search.autocomplete("option","minLength", 0);
self.search.autocomplete("search"); self.search.autocomplete("search");
@ -913,6 +913,9 @@ var et2_link_entry = et2_inputWidget.extend(
} }
event.data.options.value.id = selected.item.value; event.data.options.value.id = selected.item.value;
// Set a processing flag to filter some events
event.data.processing = true;
// Remove specific display and revert to CSS file // Remove specific display and revert to CSS file
// show() would use inline, should be inline-block // show() would use inline, should be inline-block
this.clear.css('display',''); this.clear.css('display','');
@ -920,6 +923,9 @@ var et2_link_entry = et2_inputWidget.extend(
// Fire change event // Fire change event
this.search.change(); this.search.change();
// Turn off processing flag when done
window.setTimeout(jQuery.proxy(function() {delete this.processing;},event.data));
}, },
/** /**