mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 16:14:25 +03:00
53bdb5720f
refs https://github.com/TryGhost/Team/issues/1109 - added `<CustomThemeSettings::Image>` component that is displayed for any custom theme settings with the type `'image'`
30 lines
771 B
JavaScript
30 lines
771 B
JavaScript
import Component from '@glimmer/component';
|
|
import {
|
|
IMAGE_EXTENSIONS,
|
|
IMAGE_MIME_TYPES
|
|
} from 'ghost-admin/components/gh-image-uploader';
|
|
import {action} from '@ember/object';
|
|
import {camelize} from '@ember/string';
|
|
import {guidFor} from '@ember/object/internals';
|
|
|
|
export default class CustomThemeSettingsImageComponent extends Component {
|
|
inputId = `input-${guidFor(this)}`;
|
|
inputName = camelize(this.args.setting.key);
|
|
|
|
imageExtensions = IMAGE_EXTENSIONS;
|
|
imageMimeTypes = IMAGE_MIME_TYPES;
|
|
|
|
@action
|
|
imageUploaded(images) {
|
|
if (images[0]) {
|
|
this.updateValue(images[0].url);
|
|
}
|
|
}
|
|
|
|
@action
|
|
updateValue(value) {
|
|
this.args.setting.set('value', value);
|
|
this.args.onChange?.();
|
|
}
|
|
}
|