mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
🐛 Fixed post feature image caption updates saving with every keystroke (#18833)
closes TryGhost/Product#4093 - added proper on blur handling to trigger autosave instead of each update to the caption text
This commit is contained in:
parent
0c972d8276
commit
3f368d05d9
5 changed files with 12 additions and 1 deletions
|
@ -75,7 +75,7 @@
|
|||
@onChangeHtml={{this.setCaption}}
|
||||
@placeholderText={{if this.captionInputFocused "" "Add a caption to the feature image"}}
|
||||
@onFocus={{fn (mut this.captionInputFocused) true}}
|
||||
@onBlur={{fn (mut this.captionInputFocused) false}}
|
||||
@onBlur={{this.handleCaptionBlur}}
|
||||
/>
|
||||
{{/if}}
|
||||
<button
|
||||
|
|
|
@ -39,6 +39,12 @@ export default class GhEditorFeatureImageComponent extends Component {
|
|||
this.args.updateCaption(cleanedHtml);
|
||||
}
|
||||
|
||||
@action
|
||||
handleCaptionBlur() {
|
||||
this.captionInputFocused = false;
|
||||
this.args.handleCaptionBlur();
|
||||
}
|
||||
|
||||
@action
|
||||
setUploadedImage(results) {
|
||||
if (results[0]) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
@updateAlt={{@setFeatureImageAlt}}
|
||||
@caption={{@featureImageCaption}}
|
||||
@updateCaption={{@setFeatureImageCaption}}
|
||||
@handleCaptionBlur={{@handleFeatureImageCaptionBlur}}
|
||||
@forceButtonDisplay={{or (not @title) (eq @title "(Untitled)") this.titleIsHovered this.titleIsFocused}}
|
||||
@isHidden={{or (not @cardOptions.post.showTitleAndFeatureImage) false}}
|
||||
/>
|
||||
|
|
|
@ -347,7 +347,10 @@ export default class LexicalEditorController extends Controller {
|
|||
@action
|
||||
setFeatureImageCaption(html) {
|
||||
this.post.set('featureImageCaption', html);
|
||||
}
|
||||
|
||||
@action
|
||||
handleFeatureImageCaptionBlur() {
|
||||
if (this.post.isDraft) {
|
||||
this.autosaveTask.perform();
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
@setFeatureImage={{this.setFeatureImage}}
|
||||
@setFeatureImageAlt={{this.setFeatureImageAlt}}
|
||||
@setFeatureImageCaption={{this.setFeatureImageCaption}}
|
||||
@handleFeatureImageCaptionBlur={{this.handleFeatureImageCaptionBlur}}
|
||||
@clearFeatureImage={{this.clearFeatureImage}}
|
||||
@cardOptions={{hash
|
||||
post=this.post
|
||||
|
|
Loading…
Add table
Reference in a new issue