mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Merge pull request #6697 from jeffjewiss/save-draft-title-on-blur
Saves post title on focus blur if status is draft
This commit is contained in:
commit
5cba0810fc
2 changed files with 20 additions and 1 deletions
|
@ -398,6 +398,25 @@ export default Mixin.create({
|
|||
return transition.retry();
|
||||
},
|
||||
|
||||
updateTitle() {
|
||||
let currentTitle = this.model.get('title');
|
||||
let newTitle = this.model.get('titleScratch').trim();
|
||||
|
||||
if (currentTitle === newTitle) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.get('model.isDraft') && !this.get('model.isNew')) {
|
||||
// this is preferrable to setting hasDirtyAttributes to false manually
|
||||
this.model.set('title', newTitle);
|
||||
|
||||
this.send('save', {
|
||||
silent: true,
|
||||
backgroundSave: true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
toggleReAuthenticateModal() {
|
||||
this.toggleProperty('showReAuthenticateModal');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<section class="gh-view">
|
||||
<header class="view-header">
|
||||
{{#gh-view-title classNames="gh-editor-title" openMobileMenu="openMobileMenu"}}
|
||||
{{gh-trim-focus-input type="text" id="entry-title" placeholder="Your Post Title" value=model.titleScratch tabindex="1" focus=shouldFocusTitle}}
|
||||
{{gh-trim-focus-input type="text" id="entry-title" placeholder="Your Post Title" value=model.titleScratch tabindex="1" focus=shouldFocusTitle focus-out="updateTitle" }}
|
||||
{{/gh-view-title}}
|
||||
<section class="view-actions">
|
||||
<button type="button" class="post-settings" title="Post Settings" {{action "openSettingsMenu"}}>
|
||||
|
|
Loading…
Add table
Reference in a new issue