aboutsummaryrefslogtreecommitdiff
path: root/src/settings/components/form
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-29 20:07:23 +0900
committerGitHub <noreply@github.com>2019-05-29 20:07:23 +0900
commit68673957edad21700c58d252542a0aee04115d22 (patch)
tree7a58c00d82372a27b03fcbcdbf63d3fc7ec52c39 /src/settings/components/form
parentaea17a52d692310ac459410c7d6b4e0bfd5e0225 (diff)
parent698f905145755954647f91ae01f5966b9e35a91e (diff)
Merge pull request #596 from ueokande/qa-0.23
QA 0.23
Diffstat (limited to 'src/settings/components/form')
-rw-r--r--src/settings/components/form/SearchForm.tsx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/settings/components/form/SearchForm.tsx b/src/settings/components/form/SearchForm.tsx
index cf78a69..6ba6cfb 100644
--- a/src/settings/components/form/SearchForm.tsx
+++ b/src/settings/components/form/SearchForm.tsx
@@ -54,6 +54,7 @@ class SearchForm extends React.Component<Props> {
</div>;
}
+ // eslint-disable-next-line max-statements
bindValue(e: any) {
let value = this.props.value.toJSON();
let name = e.target.name;
@@ -72,8 +73,12 @@ class SearchForm extends React.Component<Props> {
next.default = value.engines[index][0];
} else if (name === 'add') {
next.engines.push(['', '']);
- } else if (name === 'delete') {
+ } else if (name === 'delete' && value.engines.length > 1) {
next.engines.splice(index, 1);
+ if (value.engines[index][0] === value.default) {
+ let nextIndex = Math.min(index, next.engines.length - 1);
+ next.default = next.engines[nextIndex][0];
+ }
}
this.props.onChange(FormSearch.valueOf(next));