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:
parent
3cae5a55dd
commit
8ab1ed1f13
4 changed files with 15 additions and 9 deletions
|
@ -1,7 +0,0 @@
|
||||||
var FocusInput = Ember.TextField.extend({
|
|
||||||
becomeFocused: function () {
|
|
||||||
this.$().val(this.$().val()).focus();
|
|
||||||
}.on('didInsertElement')
|
|
||||||
});
|
|
||||||
|
|
||||||
export default FocusInput;
|
|
13
ghost/admin/components/gh-trim-focus-input.js
Normal file
13
ghost/admin/components/gh-trim-focus-input.js
Normal 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;
|
|
@ -4,7 +4,7 @@ var Post = DS.Model.extend(ValidationEngine, {
|
||||||
validationType: 'post',
|
validationType: 'post',
|
||||||
|
|
||||||
uuid: DS.attr('string'),
|
uuid: DS.attr('string'),
|
||||||
title: DS.attr('string'),
|
title: DS.attr('string', {defaultValue: ''}),
|
||||||
slug: DS.attr('string'),
|
slug: DS.attr('string'),
|
||||||
markdown: DS.attr('string', {defaultValue: ''}),
|
markdown: DS.attr('string', {defaultValue: ''}),
|
||||||
html: DS.attr('string'),
|
html: DS.attr('string'),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<header>
|
<header>
|
||||||
<section class="box entry-title">
|
<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>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue