Add context menus to action button in Chromium.

This commit is contained in:
Bauke 2022-03-20 19:43:44 +01:00
parent dcf395f01d
commit bdb06a1b15
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,9 @@ import {Settings} from '../settings/settings.js';
import {updateBadge} from '../utilities/badge.js'; import {updateBadge} from '../utilities/badge.js';
export async function initializeContextMenus(): Promise<void> { export async function initializeContextMenus(): Promise<void> {
const actionContext =
import.meta.env.VITE_BROWSER === 'chromium' ? 'action' : 'browser_action';
const contextMenus: browser.Menus.CreateCreatePropertiesType[] = [ const contextMenus: browser.Menus.CreateCreatePropertiesType[] = [
{ {
id: 'queue-add-new-link', id: 'queue-add-new-link',
@ -13,12 +16,12 @@ export async function initializeContextMenus(): Promise<void> {
{ {
id: 'queue-open-next-link-in-new-tab', id: 'queue-open-next-link-in-new-tab',
title: 'Open next link in new tab', title: 'Open next link in new tab',
contexts: ['browser_action'], contexts: [actionContext],
}, },
{ {
id: 'queue-open-options-page', id: 'queue-open-options-page',
title: 'Open the extension page', title: 'Open the extension page',
contexts: ['browser_action'], contexts: [actionContext],
}, },
]; ];