diff options
author | Shin'ya UEOKA <ueokande@i-beam.org> | 2019-08-29 04:23:42 +0000 |
---|---|---|
committer | Shin'ya UEOKA <ueokande@i-beam.org> | 2019-08-29 04:24:18 +0000 |
commit | f719ce52a36024887e4976082c2ef2b136f2f5ca (patch) | |
tree | fe482c85c494436a9ad2b69d077353d217cf8ae4 /src/settings | |
parent | 5197f22f9b9168a82e7cc6b0e0c1a6b970101e34 (diff) |
Save on checkbox changed
Diffstat (limited to 'src/settings')
-rw-r--r-- | src/settings/components/form/PropertiesForm.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/settings/components/form/PropertiesForm.tsx b/src/settings/components/form/PropertiesForm.tsx index 0be5f5c..ee98b7e 100644 --- a/src/settings/components/form/PropertiesForm.tsx +++ b/src/settings/components/form/PropertiesForm.tsx @@ -25,12 +25,19 @@ class PropertiesForm extends React.Component<Props> { Object.keys(types).map((name) => { let type = types[name]; let inputType = ''; + let onChange = this.bindValue.bind(this); if (type === 'string') { inputType = 'text'; } else if (type === 'number') { inputType = 'number'; } else if (type === 'boolean') { inputType = 'checkbox'; + + // Settings are saved onBlur, but checkbox does not fire it + onChange = (e) => { + this.bindValue(e); + this.props.onBlur(); + }; } else { return null; } @@ -40,7 +47,7 @@ class PropertiesForm extends React.Component<Props> { <input type={inputType} name={name} className='column-input' value={value[name] ? value[name] : ''} - onChange={this.bindValue.bind(this)} + onChange={onChange} onBlur={this.props.onBlur} checked={value[name]} /> |