Skip to content

Commit

Permalink
Fix regression: don't show disabled top level context menu item on th…
Browse files Browse the repository at this point in the history
…e content area
  • Loading branch information
piroor committed Nov 13, 2023
1 parent ab55e11 commit 33d6c44
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions background/context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,31 +144,30 @@ async function refreshFormatItems() {
visible: format.enabled !== false
};
mFormatItems.set(id, item);
const topLevelVisible = topLevelShown && item.visible && configs.showContextCommandOnTab;
promises.push(
createItem({
item.visible && createItem({
...item,
id: `${id}:clipboardOnTabTopLevel`,
icons: browser.runtime.getManifest().icons,
contexts: ['tab'],
visible: topLevelVisible
visible: topLevelShown && item.visible && configs.showContextCommandOnTab,
}),
createItem({
item.visible && createItem({
...item,
id: `${id}:under_clipboardOnTab`,
parentId: 'clipboardOnTab'
parentId: 'clipboardOnTab',
}),
createItem({
item.visible && createItem({
...item,
id: `${id}:clipboardOnPageTopLevel`,
icons: browser.runtime.getManifest().icons,
contexts: ['page'],
visible: topLevelVisible
visible: topLevelShown && item.visible && configs.showContextCommandOnPage,
}),
createItem({
item.visible && createItem({
...item,
id: `${id}:under_clipboardOnPage`,
parentId: 'clipboardOnPage'
parentId: 'clipboardOnPage',
})
);
}
Expand Down

0 comments on commit 33d6c44

Please sign in to comment.