From 97e70f22b05ccc3033362bc5f603fd3a825c7807 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. --- ghost/admin/components/gh-navitem-url-input.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ghost/admin/components/gh-navitem-url-input.js b/ghost/admin/components/gh-navitem-url-input.js index 14b5d3aaf1..5f6ca2c392 100644 --- a/ghost/admin/components/gh-navitem-url-input.js +++ b/ghost/admin/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'),