From dccccb3ae66a9fd46a23988b189bc99a94f9c802 Mon Sep 17 00:00:00 2001 From: "YUKI \"Piro\" Hiroshi" Date: Mon, 13 Nov 2023 12:45:03 +0900 Subject: [PATCH] Don't show empty context menu item when all format items are disabled --- background/context-menu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/background/context-menu.js b/background/context-menu.js index 845577a..906990e 100644 --- a/background/context-menu.js +++ b/background/context-menu.js @@ -361,6 +361,7 @@ async function onShown(info, tab) { 'context_copyTab_label'; let updated = false; let useTopLevelItem = false; + const hasMultipleVisibleItems = [...mFormatItems.values()].filter(item => item.visible).length > 1; for (const item of mMenuItems) { if (item.hiddenForTopLevelItem) useTopLevelItem = true; @@ -369,7 +370,7 @@ async function onShown(info, tab) { item.visible = ( !item.hiddenForTopLevelItem && configs[item.config] && - mFormatItems.size > 0 && + hasMultipleVisibleItems && (context.shouldCopyMultipleTabs || (configs.modeForNoSelection != Constants.kCOPY_NOTHING)) ); item.title = browser.i18n.getMessage(titleKey);