I have something like this in my background.js
:
chrome.contextMenus.create({
title: "Log Some Text",
contexts: ["selection"],
onclick: info => {
console.log(info.selectionText);
}
});
I'd like to have possibility to "log some text" even when it's not highlighted.
So, I replaced snippet above to:
chrome.contextMenus.create({
title: "Log Some Text",
contexts: ["all"],
onclick: info => {
// How to get DOM node here? Or text under DOM node?
}
});
I understand that I probably should have content
script for such cases but I don't have it now and don't really want to add it for such a simple feature.
So, I'm wondering if google chrome extensions allowed to get DOM elements when you start context menu on them.