mirror of
https://github.com/maputnik/editor.git
synced 2025-12-26 16:10:01 +00:00
Always have default value if value not set
This commit is contained in:
@@ -51,8 +51,8 @@ export default class SpecField extends React.Component {
|
||||
render() {
|
||||
const commonProps = {
|
||||
style: this.props.style,
|
||||
default: this.props.fieldSpec.default,
|
||||
value: this.props.value,
|
||||
default: this.props.fieldSpec.default,
|
||||
name: this.props.fieldName,
|
||||
onChange: newValue => this.props.onChange(this.props.fieldName, newValue)
|
||||
}
|
||||
@@ -70,13 +70,11 @@ export default class SpecField extends React.Component {
|
||||
if(options.length <= 3 && optionsLabelLength(options) <= 20) {
|
||||
return <MultiButtonInput
|
||||
{...commonProps}
|
||||
value={this.props.value || this.props.fieldSpec.default}
|
||||
options={options}
|
||||
/>
|
||||
} else {
|
||||
return <SelectInput
|
||||
{...commonProps}
|
||||
value={this.props.value || this.props.fieldSpec.default}
|
||||
options={options}
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user