mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-05 01:17:23 +00:00
pages/search: store: closeCurrentTab
This commit is contained in:
parent
dbb7724253
commit
c6f4fda801
4 changed files with 12 additions and 13 deletions
|
|
@ -38,12 +38,6 @@ export const attachInputHandlers = (store) => {
|
|||
const actionbox = document.getElementById('actionbox')
|
||||
actionbox.value = ''
|
||||
|
||||
/* Switch to tab */
|
||||
const switchToTab = (tabId) => {
|
||||
store.actions.goToTab(parseInt(tabId))
|
||||
window.close()
|
||||
}
|
||||
|
||||
/* Arrow keys */
|
||||
document.addEventListener('keydown', (e) => {
|
||||
focusButtonsWithArrows(e, () => {
|
||||
|
|
@ -58,8 +52,8 @@ export const attachInputHandlers = (store) => {
|
|||
/* Buttons */
|
||||
document.addEventListener('click', (event) => {
|
||||
if (event.target.classList.contains('tab')) {
|
||||
const tabId = event.target.dataset.id
|
||||
switchToTab(tabId)
|
||||
const tabId = parseInt(event.target.dataset.id)
|
||||
store.actions.goToTab(tabId)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -82,7 +76,7 @@ export const attachInputHandlers = (store) => {
|
|||
let visibleTabs = store.getCurrentState().results
|
||||
if (visibleTabs.length > 0) {
|
||||
const tabId = visibleTabs[0].obj.id
|
||||
switchToTab(tabId)
|
||||
store.actions.goToTab(tabId)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue