mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
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);
|
||
|
}
|
||
|
}
|