mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-04 17:07:23 +00:00
pages/search: actions: discardTab
This commit is contained in:
parent
bcf56cf841
commit
f8ec211e19
2 changed files with 20 additions and 4 deletions
|
|
@ -15,12 +15,12 @@ export const actionboxHandlers = (commandQuery, store, flush) => {
|
||||||
/* */
|
/* */
|
||||||
'f': switchToTab,
|
'f': switchToTab,
|
||||||
'd': closeTab,
|
'd': closeTab,
|
||||||
|
/* */
|
||||||
'c': duplicateTab,
|
'c': duplicateTab,
|
||||||
/* TODO */
|
's': discardTab,
|
||||||
// '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
|
// 'e': Pop the tab into it's own window with minimal UI
|
||||||
|
// 'm': Mute or unmute the tab
|
||||||
|
// 'p': Pin or unpin the tab
|
||||||
}[command] ?? noop(command))(store, label, flush)
|
}[command] ?? noop(command))(store, label, flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,6 +63,14 @@ function closeTab (store, label, flush) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function discardTab (store, label, flush) {
|
||||||
|
const tab = getTabByLabel(store, label)
|
||||||
|
if (tab) {
|
||||||
|
flush()
|
||||||
|
store.actions.discardTab(tab.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function duplicateTab (store, label, flush) {
|
function duplicateTab (store, label, flush) {
|
||||||
const tab = getTabByLabel(store, label)
|
const tab = getTabByLabel(store, label)
|
||||||
if (tab) {
|
if (tab) {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,14 @@ export const init = ({
|
||||||
url,
|
url,
|
||||||
}).then(updateState)
|
}).then(updateState)
|
||||||
},
|
},
|
||||||
|
discardTab(id) {
|
||||||
|
browserTabs.discard(id)
|
||||||
|
.then(updateState)
|
||||||
|
},
|
||||||
|
updateTab(id, options) {
|
||||||
|
browserTabs.update(id, options)
|
||||||
|
.then(updateState)
|
||||||
|
},
|
||||||
updateQuery(query) {
|
updateQuery(query) {
|
||||||
state.query = query
|
state.query = query
|
||||||
updateState()
|
updateState()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue