0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Do not focus post title when editing.

This commit is contained in:
Robert Jackson 2014-08-08 09:30:51 -04:00
parent 918a911d3f
commit 1d360b3d18
No known key found for this signature in database
GPG key ID: B3D10EF8171F7219
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>