From 37cd9d2f912c6df9b7ae7616f2fa53caafd6608d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 27 May 2019 20:57:26 +0900 Subject: Set default engine and remain last engine on form settings --- src/settings/components/form/SearchForm.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/settings') 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 { ; } + // 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 { 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)); -- cgit v1.2.3 From c8f54a899d6c98f6c6dceae4841685ffc733365b Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 27 May 2019 21:06:15 +0900 Subject: Fix form keys --- src/settings/keymaps.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/settings') diff --git a/src/settings/keymaps.ts b/src/settings/keymaps.ts index ffe0d48..2a66f9a 100644 --- a/src/settings/keymaps.ts +++ b/src/settings/keymaps.ts @@ -1,3 +1,5 @@ +/* eslint-disable max-len */ + const fields = [ [ ['scroll.vertically?{"count":1}', 'Scroll down'], @@ -19,8 +21,8 @@ const fields = [ ['tabs.close', 'Close a tab'], ['tabs.close.right', 'Close tabs to the right'], ['tabs.reopen', 'Reopen closed tab'], - ['tabs.next?{"count":1}', 'Select next Tab'], - ['tabs.prev?{"count":1}', 'Select prev Tab'], + ['tabs.next', 'Select next Tab'], + ['tabs.prev', 'Select prev Tab'], ['tabs.first', 'Select first tab'], ['tabs.last', 'Select last tab'], ['tabs.reload?{"cache":false}', 'Reload current tab'], @@ -28,8 +30,8 @@ const fields = [ ['tabs.pin.toggle', 'Toggle pinned state'], ['tabs.duplicate', 'Duplicate a tab'], ], [ - ['follow.start?{"newTab":false}', 'Follow a link'], - ['follow.start?{"newTab":true}', 'Follow a link in new tab'], + ['follow.start?{"newTab":false,"background":false}', 'Follow a link'], + ['follow.start?{"newTab":true,"background":false}', 'Follow a link in new tab'], ['navigate.history.prev', 'Go back in histories'], ['navigate.history.next', 'Go forward in histories'], ['navigate.link.next', 'Open next link'], @@ -37,7 +39,7 @@ const fields = [ ['navigate.parent', 'Go to parent directory'], ['navigate.root', 'Go to root directory'], ['page.source', 'Open page source'], - ['page.home', 'Open start page to current tab'], + ['page.home?{"newTab":false}', 'Open start page to current tab'], ['page.home?{"newTab":true}', 'Open start page in new tab'], ['focus.input', 'Focus input'], ], [ -- cgit v1.2.3 From 698f905145755954647f91ae01f5966b9e35a91e Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 27 May 2019 21:09:36 +0900 Subject: Save settings on switching a source --- src/settings/components/index.tsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/settings') diff --git a/src/settings/components/index.tsx b/src/settings/components/index.tsx index b4a0866..eeac2cf 100644 --- a/src/settings/components/index.tsx +++ b/src/settings/components/index.tsx @@ -175,6 +175,7 @@ class SettingsComponent extends React.Component { if (from === 'form' && value === 'json') { this.props.dispatch(settingActions.switchToJson( this.props.form as FormSettings)); + this.save(); } else if (from === 'json' && value === 'form') { let b = window.confirm(DO_YOU_WANT_TO_CONTINUE); if (!b) { @@ -183,6 +184,7 @@ class SettingsComponent extends React.Component { } this.props.dispatch( settingActions.switchToForm(this.props.json as JSONSettings)); + this.save(); } } -- cgit v1.2.3