mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Merge pull request #4860 from jaswilli/add-on-enter
Add new navigation item on enter key
This commit is contained in:
commit
366ed7c220
1 changed files with 15 additions and 0 deletions
|
@ -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'),
|
||||
|
|
Loading…
Add table
Reference in a new issue