El propósito de mi complemento es exportar un solo correo electrónico o una carpeta completa para su posterior análisis. Por el momento, he creado un campo dentro del menú para el elemento único, pero no entiendo cómo acceder al elemento en el que hice clic derecho. ¿Alguien puede explicarme cómo acceder al elemento, ya sea el correo electrónico individual o la caja?
/* Called when the item has been created, or when creation failed due to an error. We'll just log success/failure here. */ function onCreated() { if (browser.runtime.lastError) { console.log(`Error: ${browser.runtime.lastError}`); } else { console.log("Item created successfully"); } } /* Create all the context menu items. */ browser.menus.create({ id: "log-selection", title: browser.i18n.getMessage("menuItemSelectionLogger"), contexts: ["selection"] }, onCreated); browser.menus.create({ id: "analyse", type: "radio", title: browser.i18n.getMessage("menuItemAnalyse"), contexts: ["all"], checked: true, icons: { "16": "icons/paint-green-16.png", "32": "icons/paint-green-32.png" } }, onCreated); browser.menus.create({ id: "export", type: "radio", title: browser.i18n.getMessage("menuItemExport"), contexts: ["all"], checked: true, icons: { "16": "icons/paint-green-16.png", "32": "icons/paint-green-32.png" } }, onCreated); /* The click event listener, where we perform the appropriate action given the ID of the menu item that was clicked. */ browser.menus.onClicked.addListener((info, tab) => { switch (info.menuItemId) { case "log-selection": console.log(info.selectionText); break; case "analyse": break; case "export": break; } });