mirror of
https://github.com/maputnik/editor.git
synced 2025-12-24 23:20:00 +00:00
Added UrlInput component to tidy things up a little.
This commit is contained in:
@@ -8,10 +8,15 @@ class StringInput extends React.Component {
|
||||
style: PropTypes.object,
|
||||
default: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
onInput: PropTypes.func,
|
||||
multi: PropTypes.bool,
|
||||
required: PropTypes.bool,
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
onInput: () => {},
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
@@ -57,7 +62,9 @@ class StringInput extends React.Component {
|
||||
this.setState({
|
||||
editing: true,
|
||||
value: e.target.value
|
||||
})
|
||||
}, () => {
|
||||
this.props.onInput(this.state.value);
|
||||
});
|
||||
},
|
||||
onBlur: () => {
|
||||
if(this.state.value!==this.props.value) {
|
||||
|
||||
Reference in New Issue
Block a user