mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-05 01:17:23 +00:00
pages/search: actions: extract tab to popup
This commit is contained in:
parent
60d28b9970
commit
194c1fa2bc
3 changed files with 18 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ export const actionboxHandlers = (commandQuery, store, flush) => {
|
||||||
'c': duplicateTab,
|
'c': duplicateTab,
|
||||||
's': discardTab,
|
's': discardTab,
|
||||||
'p': pinOrUnpinTab,
|
'p': pinOrUnpinTab,
|
||||||
// 'e': Pop the tab into it's own window with minimal UI
|
'e': moveTabToPopup,
|
||||||
}[command] ?? noop(command))(store, label, flush)
|
}[command] ?? noop(command))(store, label, flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +78,15 @@ function duplicateTab (store, label, flush) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function moveTabToPopup (store, label, flush) {
|
||||||
|
const tab = getTabByLabel(store, label)
|
||||||
|
if (tab) {
|
||||||
|
flush()
|
||||||
|
store.actions.moveTabToPopup(tab.id)
|
||||||
|
store.actions.closeCurrentTab()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function pinOrUnpinTab (store, label, flush) {
|
function pinOrUnpinTab (store, label, flush) {
|
||||||
const tab = getTabByLabel(store, label)
|
const tab = getTabByLabel(store, label)
|
||||||
if (tab) {
|
if (tab) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const fuzzysort = window.fuzzysort
|
||||||
|
|
||||||
export const init = ({
|
export const init = ({
|
||||||
tabs: browserTabs,
|
tabs: browserTabs,
|
||||||
|
windows: browserWindows,
|
||||||
onStateUpdate,
|
onStateUpdate,
|
||||||
closeCurrentTab,
|
closeCurrentTab,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
@ -94,6 +95,12 @@ export const init = ({
|
||||||
browserTabs.discard(id)
|
browserTabs.discard(id)
|
||||||
.then(updateState)
|
.then(updateState)
|
||||||
},
|
},
|
||||||
|
moveTabToPopup(id) {
|
||||||
|
browserWindows.create({
|
||||||
|
tabId: id,
|
||||||
|
type: 'popup',
|
||||||
|
}).then(updateState)
|
||||||
|
},
|
||||||
updateTab(id, options) {
|
updateTab(id, options) {
|
||||||
browserTabs.update(id, options)
|
browserTabs.update(id, options)
|
||||||
.then(updateState)
|
.then(updateState)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import * as inputHandlers from './modules/inputHandlers.js'
|
||||||
|
|
||||||
const store = Store.init({
|
const store = Store.init({
|
||||||
tabs: browser.tabs,
|
tabs: browser.tabs,
|
||||||
|
windows: browser.windows,
|
||||||
onStateUpdate: dom.updateSearchResults,
|
onStateUpdate: dom.updateSearchResults,
|
||||||
closeCurrentTab: () => window.close(),
|
closeCurrentTab: () => window.close(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue