mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 18:41:16 +01:00
Always put an empty field and the end of the FontInput and remove blank fields if empty
This commit is contained in:
parent
52740483b6
commit
a066710bfb
1 changed files with 11 additions and 2 deletions
|
@ -16,13 +16,22 @@ class FontInput extends React.Component {
|
|||
}
|
||||
|
||||
get values() {
|
||||
return this.props.value || this.props.default.slice(1) || []
|
||||
const out = this.props.value || this.props.default.slice(1) || [""];
|
||||
|
||||
// Always put a "" in the last field to you can keep adding entries
|
||||
if (out[out.length-1] !== ""){
|
||||
return out.concat("");
|
||||
}
|
||||
else {
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
changeFont(idx, newValue) {
|
||||
const changedValues = this.values.slice(0)
|
||||
changedValues[idx] = newValue
|
||||
this.props.onChange(changedValues)
|
||||
const filteredValues = changedValues.filter(v => v !== undefined);
|
||||
this.props.onChange(filteredValues);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
Loading…
Reference in a new issue