chrome.contextMenus.create({ id: "copyImageLink", title: "Copy Image Link", contexts: ["image"], onclick: (info, tab) => { // Get the URL of the clicked image const imageUrl = info.srcUrl; // Copy the image URL to the clipboard navigator.clipboard.writeText("![](" + imageUrl + ")") .then(() => { console.log("Image URL copied to clipboard:", imageUrl); }) .catch(error => { console.error("Error copying image URL:", error); }); } });