aboutsummaryrefslogtreecommitdiff
path: root/src/settings/components/form/BlacklistForm.jsx
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-04-30 09:49:45 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-04-30 09:50:05 +0900
commit20f79f1da54441fe22a172009d34734af1bd3807 (patch)
tree9e2efd32c4c2b6e1ad22b598c8b0709de327602d /src/settings/components/form/BlacklistForm.jsx
parentfce2434dcdef126a3ab180447e7cb48bc24ec1f9 (diff)
Save settings by onBlur callback
Diffstat (limited to 'src/settings/components/form/BlacklistForm.jsx')
-rw-r--r--src/settings/components/form/BlacklistForm.jsx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/settings/components/form/BlacklistForm.jsx b/src/settings/components/form/BlacklistForm.jsx
index cf7cffe..c470758 100644
--- a/src/settings/components/form/BlacklistForm.jsx
+++ b/src/settings/components/form/BlacklistForm.jsx
@@ -13,9 +13,13 @@ class BlacklistForm extends React.Component {
return <div key={index} className='form-blacklist-form-row'>
<input data-index={index} type='text' name='url'
className='column-url' value={url}
- onChange={this.bindValue.bind(this)} />
+ onChange={this.bindValue.bind(this)}
+ onBlur={this.props.onBlur}
+ />
<DeleteButton data-index={index} name='delete'
- onClick={this.bindValue.bind(this)} />
+ onClick={this.bindValue.bind(this)}
+ onBlur={this.props.onBlur}
+ />
</div>;
})
}
@@ -38,17 +42,22 @@ class BlacklistForm extends React.Component {
}
this.props.onChange(next);
+ if (name === 'delete') {
+ this.props.onBlur();
+ }
}
}
BlacklistForm.propTypes = {
value: PropTypes.arrayOf(PropTypes.string),
onChange: PropTypes.func,
+ onBlur: PropTypes.func,
};
BlacklistForm.defaultProps = {
value: [],
onChange: () => {},
+ onBlur: () => {},
};
export default BlacklistForm;