diff --git a/content.js b/content.js index d0752d6..febf5ec 100644 --- a/content.js +++ b/content.js @@ -66,6 +66,16 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { performRmdownActions(); sendResponse({ success: true }); return true; + } else if (request.action === "copyTitle") { + const pageTitle = document.title; + navigator.clipboard.writeText(pageTitle).then(() => { + console.log("Title copied to clipboard:", pageTitle); + sendResponse({ success: true, title: pageTitle }); + }).catch(err => { + console.error("Failed to copy title:", err); + sendResponse({ success: false, error: err.message }); + }); + return true; // Indicates that the response is sent asynchronously } }); diff --git a/popup.html b/popup.html index cd07543..49f5e36 100644 --- a/popup.html +++ b/popup.html @@ -3,9 +3,14 @@