diff --git a/pages/search/modules/actionboxHandlers.js b/pages/search/modules/actionboxHandlers.js index 1d04731..6a1cd91 100644 --- a/pages/search/modules/actionboxHandlers.js +++ b/pages/search/modules/actionboxHandlers.js @@ -10,19 +10,25 @@ export const actionboxHandlers = (commandQuery, store, flush) => { ({ '?': openHelp, - 'x': closeCurrentTab, + 'q': closeCurrentTab, 'r': reloadCurrentTab, /* */ 'f': switchToTab, 'd': closeTab, 'c': duplicateTab, + /* TODO */ + // 'p': Pin or unpin the tab + // 'm': Mute or unmute the tab + // 's': Put the tab to sleep + // 'e': Pop the tab into it's own window with minimal UI }[command] ?? noop(command))(store, label, flush) } /* */ function openHelp () { - + const helpLink = 'https://github.com/He4eT/tabswitcher#Tabswitcher' + location.href = helpLink } function closeCurrentTab () { @@ -44,7 +50,6 @@ function switchToTab (store, label) { const tab = getTabByLabel(store, label) if (tab) { store.actions.goToTab(tab.id) - flush() closeCurrentTab() } } @@ -52,18 +57,18 @@ function switchToTab (store, label) { function closeTab (store, label, flush) { const tab = getTabByLabel(store, label) if (tab) { - store.actions.closeTab(tab.id) flush() + store.actions.closeTab(tab.id) } } function duplicateTab (store, label, flush) { const tab = getTabByLabel(store, label) if (tab) { + flush() browser.tabs.create({ active: false, url: tab.url, }).then(store.actions.updateState) - flush() } } diff --git a/pages/search/modules/inputHandlers.js b/pages/search/modules/inputHandlers.js index a5c8961..e75ba61 100644 --- a/pages/search/modules/inputHandlers.js +++ b/pages/search/modules/inputHandlers.js @@ -80,11 +80,9 @@ export const attachInputHandlers = (store) => { searchBox.addEventListener('keydown', (e) => { if (e.key === 'Enter') { let visibleTabs = store.getCurrentState().results - if (visibleTabs.length === 1) { + if (visibleTabs.length > 0) { const tabId = visibleTabs[0].obj.id switchToTab(tabId) - } else { - actionbox.focus() } } }) diff --git a/pages/search/search.html b/pages/search/search.html index b27ab4a..8c52757 100644 --- a/pages/search/search.html +++ b/pages/search/search.html @@ -8,11 +8,14 @@
- +
- + + + +