From b3ed3d78cb398b5ab7c3d4db14d4fb38108186aa Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Tue, 27 Jan 2015 23:14:45 +0000 Subject: [PATCH] Add new navigation item on enter key No Issue - Fix regression in add item on enter behavior. --- core/client/components/gh-navitem-url-input.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/client/components/gh-navitem-url-input.js b/core/client/components/gh-navitem-url-input.js index 14b5d3aaf1..5f6ca2c392 100644 --- a/core/client/components/gh-navitem-url-input.js +++ b/core/client/components/gh-navitem-url-input.js @@ -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'),