Merge pull request #4860 from jaswilli/add-on-enter

Add new navigation item on enter key
This commit is contained in:
Hannah Wolfe 2015-01-28 21:24:43 +00:00
commit 366ed7c220

View File

@ -58,8 +58,23 @@ var NavItemUrlInputComponent = Ember.TextField.extend({
}
},
keyPress: function (event) {
// enter key
if (event.keyCode === 13) {
event.preventDefault();
this.notifyUrlChanged();
}
return true;
},
focusOut: function () {
this.set('hasFocus', false);
this.notifyUrlChanged();
},
notifyUrlChanged: function () {
this.set('value', this.get('value').trim());
var url = this.get('value'),