Skip to content

Commit

Permalink
Bug: 13256 If knl is open, only process the selected node.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jun 11, 2014
1 parent 5cf474a commit c30ef30
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions framework/Core/js/prettyautocomplete.js
Expand Up @@ -9,6 +9,8 @@

var PrettyAutocompleter = Class.create({

aac: null,

initialize: function(element, params)
{
this.p = Object.extend({
Expand Down Expand Up @@ -87,7 +89,7 @@ var PrettyAutocompleter = Class.create({

// Make sure the knl is contained in the overlay
this.p.domParent = this.p.box;
new Ajax.Autocompleter(this.p.trigger, this.p.uri, this.p);
this.aac = new Ajax.Autocompleter(this.p.trigger, this.p.uri, this.p);

this.initialized = true;

Expand Down Expand Up @@ -165,14 +167,20 @@ var PrettyAutocompleter = Class.create({
_onKeyDown: function(e)
{
// Check for a comma or enter
if ((e.keyCode == 188 || e.keyCode == Event.KEY_RETURN) && !this.p.requireSelection) {
if ((e.keyCode == 188 || (this._honorReturn() && e.keyCode == Event.KEY_RETURN)) && !this.p.requireSelection) {
this._processValue();
e.stop();
} else if (e.keyCode == 188) {
e.stop();
}
},

_honorReturn: function()
{
return (this.aac.knl && !this.aac.knl.getCurrentEntry()) ||
!this.aac.knl;
},

_processValue: function()
{
var value = $F(this.p.trigger).replace(/^,/, '').strip();
Expand Down

0 comments on commit c30ef30

Please sign in to comment.