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

Trim title in editor on blue/focusOut

closes #3040, fixes #3038
- Properly trim title
- Re-add casper test/adjust where necessary
- Rename gh-focus-input component
This commit is contained in:
Fabian Becker 2014-06-23 17:50:28 +00:00
parent 3cae5a55dd
commit 8ab1ed1f13
4 changed files with 15 additions and 9 deletions

View file

@ -1,7 +0,0 @@
var FocusInput = Ember.TextField.extend({
becomeFocused: function () {
this.$().val(this.$().val()).focus();
}.on('didInsertElement')
});
export default FocusInput;

View file

@ -0,0 +1,13 @@
var TrimFocusInput = Ember.TextField.extend({
setFocus: function () {
this.$().val(this.$().val()).focus();
}.on('didInsertElement'),
focusOut: function () {
var text = this.$().val();
this.$().val(text.trim());
}
});
export default TrimFocusInput;

View file

@ -4,7 +4,7 @@ var Post = DS.Model.extend(ValidationEngine, {
validationType: 'post',
uuid: DS.attr('string'),
title: DS.attr('string'),
title: DS.attr('string', {defaultValue: ''}),
slug: DS.attr('string'),
markdown: DS.attr('string', {defaultValue: ''}),
html: DS.attr('string'),

View file

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