mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-05 01:17:23 +00:00
pages/search: add actionbox handlers
This commit is contained in:
parent
3e770a0d65
commit
45cf56e255
3 changed files with 83 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { actionboxHandlers } from './actionboxHandlers.js'
|
||||
|
||||
const focusButtonsWithArrows = (e, abortCallback) => {
|
||||
if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
|
||||
e.preventDefault()
|
||||
|
|
@ -31,7 +33,10 @@ const focusButtonsWithArrows = (e, abortCallback) => {
|
|||
|
||||
export const attachInputHandlers = (store) => {
|
||||
const searchBox = document.getElementById('searchbox')
|
||||
searchBox.value = ''
|
||||
|
||||
const actionbox = document.getElementById('actionbox')
|
||||
actionbox.value = ''
|
||||
|
||||
/* Switch to tab */
|
||||
const switchToTab = (tabId) => {
|
||||
|
|
@ -58,6 +63,14 @@ export const attachInputHandlers = (store) => {
|
|||
}
|
||||
})
|
||||
|
||||
/* Actionbox */
|
||||
actionbox.addEventListener('input', (e) => {
|
||||
const commandQuery = e.target.value
|
||||
const flush = () => (actionbox.value = '')
|
||||
|
||||
actionboxHandlers(commandQuery, store, flush)
|
||||
})
|
||||
|
||||
/* Searchbox*/
|
||||
|
||||
searchBox.addEventListener('input', (e) => {
|
||||
|
|
@ -75,6 +88,4 @@ export const attachInputHandlers = (store) => {
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
/* Actionbox */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue