mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 14:22:07 +03:00
0d30077325
refs https://github.com/TryGhost/Team/issues/771 - added `<GhEditorFeatureImage>` for more flexibility than offered by `<GhImageUploaderWithPreview>` - updated to more closely match intended designs - removed alt/caption support from `<GhImageUploaderWithPreview>` as it's no longer used - fixed upload/delete/upload not working due to file input references getting out of sync
43 lines
1018 B
JavaScript
43 lines
1018 B
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class GhEditorFeatureImageComponent extends Component {
|
|
@tracked isEditingAlt = false;
|
|
@tracked isHovered = false;
|
|
@tracked captionInputFocused = false;
|
|
@tracked showUnsplashSelector = false;
|
|
|
|
get hideButton() {
|
|
return !this.isHovered && !this.args.forceButtonDisplay;
|
|
}
|
|
|
|
@action
|
|
setUploadedImage(results) {
|
|
if (results[0]) {
|
|
this.args.updateImage(results[0].url);
|
|
}
|
|
}
|
|
|
|
@action
|
|
setUnsplashImage({src, caption}) {
|
|
this.args.updateImage(src);
|
|
this.args.updateCaption(caption);
|
|
}
|
|
|
|
@action
|
|
toggleUnsplashSelector() {
|
|
this.showUnsplashSelector = !this.showUnsplashSelector;
|
|
}
|
|
|
|
@action
|
|
toggleAltEditing() {
|
|
this.isEditingAlt = !this.isEditingAlt;
|
|
}
|
|
|
|
@action
|
|
onAltInput(event) {
|
|
this.args.updateAlt(event.target.value);
|
|
}
|
|
}
|