From 9a08ff3216f74ee9e2e7727611ebc3a51db9a722 Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Mon, 23 Jun 2014 14:27:09 +0000 Subject: [PATCH] Focus title in editor when opening page. closes #3038 - Adds new gh-focus-input component - Uses new component in editor --- core/client/components/gh-focus-input.js | 7 +++++++ core/client/templates/editor/edit.hbs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 core/client/components/gh-focus-input.js diff --git a/core/client/components/gh-focus-input.js b/core/client/components/gh-focus-input.js new file mode 100644 index 0000000000..2a3528705e --- /dev/null +++ b/core/client/components/gh-focus-input.js @@ -0,0 +1,7 @@ +var FocusInput = Ember.TextField.extend({ + becomeFocused: function () { + this.$().val(this.$().val()).focus(); + }.on('didInsertElement') +}); + +export default FocusInput; diff --git a/core/client/templates/editor/edit.hbs b/core/client/templates/editor/edit.hbs index 40927e39c9..a06d788053 100644 --- a/core/client/templates/editor/edit.hbs +++ b/core/client/templates/editor/edit.hbs @@ -1,6 +1,6 @@
- {{input type="text" id="entry-title" placeholder="Your Post Title" value=title tabindex="1"}} + {{gh-focus-input type="text" id="entry-title" placeholder="Your Post Title" value=title tabindex="1"}}