Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow to clear select in meta fields #294

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addon/components/meta-fields.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<PowerSelect
@disabled={{field.readOnly}}
@options={{field.options}}
@selected={{find-by "value" (get @model.meta field.slug) @field.options}}
@selected={{find-by "value" (get @model.meta field.slug) field.options}}
@onChange={{fn this.updateMetaField field @model}}
@placeholder={{concat (get field.label this.intl.primaryLocale) "..."}}
@allowClear={{true}}
as |option|
>
{{get option.label this.intl.primaryLocale}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/meta-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class EditFormComponent extends Component {

@action
updateMetaField(field, model, optionOrEvent) {
const value = optionOrEvent.target?.value ?? optionOrEvent.value;
const value = optionOrEvent?.target?.value ?? optionOrEvent?.value;
model.meta = { ...model.meta, [field.slug]: value };
model.notifyPropertyChange("meta");
}
Expand Down