aboutsummaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
authorShin'ya UEOKA <ueokande@i-beam.org>2019-10-05 02:06:02 +0000
committerShin'ya UEOKA <ueokande@i-beam.org>2019-10-06 12:58:59 +0000
commit574692551a27ea56660bf2061daeaa0d34beaff4 (patch)
tree414a7f1de8dfb24af45d7e392b72549bc67ad48a /src/settings
parent2116ac90a6dfdb0910d7ad2896f70a052aa635cc (diff)
Make Properties class
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/components/form/PropertiesForm.tsx6
-rw-r--r--src/settings/components/index.tsx13
2 files changed, 7 insertions, 12 deletions
diff --git a/src/settings/components/form/PropertiesForm.tsx b/src/settings/components/form/PropertiesForm.tsx
index ee98b7e..db8c8e5 100644
--- a/src/settings/components/form/PropertiesForm.tsx
+++ b/src/settings/components/form/PropertiesForm.tsx
@@ -18,7 +18,7 @@ class PropertiesForm extends React.Component<Props> {
render() {
let types = this.props.types;
- let value = this.props.value;
+ let values = this.props.value;
return <div className='form-properties-form'>
{
@@ -46,10 +46,10 @@ class PropertiesForm extends React.Component<Props> {
<span className='column-name'>{name}</span>
<input type={inputType} name={name}
className='column-input'
- value={value[name] ? value[name] : ''}
+ value={values[name] ? values[name] : ''}
onChange={onChange}
onBlur={this.props.onBlur}
- checked={value[name]}
+ checked={values[name]}
/>
</label>
</div>;
diff --git a/src/settings/components/index.tsx b/src/settings/components/index.tsx
index ada6efb..e86d765 100644
--- a/src/settings/components/index.tsx
+++ b/src/settings/components/index.tsx
@@ -8,11 +8,11 @@ import BlacklistForm from './form/BlacklistForm';
import PropertiesForm from './form/PropertiesForm';
import * as settingActions from '../../settings/actions/setting';
import SettingData, {
- JSONTextSettings, FormKeymaps, FormSearch, FormSettings,
+ FormKeymaps, FormSearch, FormSettings, JSONTextSettings,
} from '../../shared/SettingData';
import { State as AppState } from '../reducers/setting';
import * as settings from '../../shared/Settings';
-import * as PropertyDefs from '../../shared/property-defs';
+import Properties from '../../shared/settings/Properties';
const DO_YOU_WANT_TO_CONTINUE =
'Some settings in JSON can be lost when migrating. ' +
@@ -33,11 +33,6 @@ class SettingsComponent extends React.Component<Props> {
}
renderFormFields(form: any) {
- let types = PropertyDefs.defs.reduce(
- (o: {[key: string]: string}, def) => {
- o[def.name] = def.type;
- return o;
- }, {});
return <div>
<fieldset>
<legend>Keybindings</legend>
@@ -66,7 +61,7 @@ class SettingsComponent extends React.Component<Props> {
<fieldset>
<legend>Properties</legend>
<PropertiesForm
- types={types}
+ types={Properties.types()}
value={form.properties}
onChange={this.bindPropertiesForm.bind(this)}
onBlur={this.save.bind(this)}
@@ -157,7 +152,7 @@ class SettingsComponent extends React.Component<Props> {
let data = new SettingData({
source: this.props.source,
form: (this.props.form as FormSettings).buildWithProperties(
- settings.propertiesValueOf(value)),
+ Properties.fromJSON(value))
});
this.props.dispatch(settingActions.set(data));
}