You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
503 B

1 month ago
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);
});
}
});