Ghost/ghost/admin/app/components/custom-theme-settings/select.js
Kevin Ansfield dab672c7b8 Wired up custom theme settings form to preview updates
refs https://github.com/TryGhost/Team/issues/1097

- added `customThemeSettings.keyValueObject` which returns a plain object with setting values assign to the setting keys on the object
- updated customize modal's preview data generation to use `customThemeSettings.keyValueObject` to assign a JSON-stringified version to the `custom` param on the `x-ghost-preview` header
- updated theme settings `<Select>` component to call the passed through `updatePreview()` action when the value changes
2021-09-30 13:30:06 +01:00

17 lines
520 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {camelize} from '@ember/string';
import {guidFor} from '@ember/object/internals';
export default class CustomThemeSettingsSelectComponent extends Component {
selectId = `select-${guidFor(this)}`;
selectName = camelize(this.args.setting.key);
@action
setSelection(changeEvent) {
const value = changeEvent.target.value;
this.args.setting.set('value', value);
this.args.onChange?.();
}
}