0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Merge pull request #3696 from rwjblue/do-not-focus-post-title

Do not focus post title when editing.
This commit is contained in:
Hannah Wolfe 2014-08-08 18:03:00 +01:00
commit aee8df77bc
3 changed files with 10 additions and 2 deletions

View file

@ -1,6 +1,10 @@
var TrimFocusInput = Ember.TextField.extend({
focus: true,
setFocus: function () {
this.$().val(this.$().val()).focus();
if (this.focus) {
this.$().val(this.$().val()).focus();
}
}.on('didInsertElement'),
focusOut: function () {

View file

@ -184,6 +184,10 @@ var EditorControllerMixin = Ember.Mixin.create(MarkerManager, {
this.notifications.showError(message, { delayed: delay });
},
shouldFocusTitle: Ember.computed('model', function () {
return !!this.get('model.isNew');
}),
actions: {
save: function () {
var status = this.get('willPublish') ? 'published' : 'draft',

View file

@ -1,6 +1,6 @@
<header>
<section class="box entry-title">
{{gh-trim-focus-input type="text" id="entry-title" placeholder="Your Post Title" value=titleScratch tabindex="1"}}
{{gh-trim-focus-input type="text" id="entry-title" placeholder="Your Post Title" value=titleScratch tabindex="1" focus=shouldFocusTitle}}
</section>
</header>