Skip to content

Commit

Permalink
Copy selected tabs correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Nov 9, 2023
1 parent eb23855 commit 8293dab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
5 changes: 5 additions & 0 deletions background/context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,11 @@ async function onShown(info, tab) {
await context.resolve();

const chooseFromMenu = (context.isTreeParent ? configs.modeForNoSelectionTree : configs.modeForNoSelection) == Constants.kCOPY_CHOOSE_FROM_MENU;
log('onShown ', {
chooseFromMenu,
isTreeParent: context.isTreeParent,
multiselected: context.multiselectedTabs.length > 1,
});
const titleKey = (context.multiselectedTabs.length > 1 || chooseFromMenu) ?
'context_copyTabs_label' :
context.shouldCopyAll ? 'context_copyAllTabs_label' :
Expand Down
16 changes: 7 additions & 9 deletions common/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ export class Context {
async resolveMultiselectedTabs() {
if (this.multiselectedTabs)
return;
this.multiselectedTabs = !this.multiselectedTabs && (
this.tab.highlighted ?
browser.tabs.query({
windowId: this.tab.windowId,
highlighted: true,
hidden: false,
}) :
[this.tab]
);
this.multiselectedTabs = this.tab.highlighted ?
(await browser.tabs.query({
windowId: this.tab.windowId,
highlighted: true,
hidden: false,
})) :
[this.tab];
}

async resolveDescendantTabs() {
Expand Down

0 comments on commit 8293dab

Please sign in to comment.