Reputation: 5885
I have a context menu, so when you selection some text from a page they can send to my extension. I am using
var child1 = chrome.contextMenus.create(
{"title": "Send To Box" , contexts:["selection"], "parentId": id, "id":"box", "contexts":[context], "onclick": sendToMyBox});
And in my sendToMyBox
function sendToMyBox(info, tab)
{
if (info.menuItemId == "box")
{
mainData = info.selectionText;
}
}
So the issue is selectionText is missing all the formatting. What ever selected its coming as a single line text, is there anyway I can get the current format from the selected. Basically I want to keep all the new lines tabs, etc...
Thanks
Upvotes: 1
Views: 451
Reputation: 10897
I think maybe you can get the html element first (you can achieve that by register a mouse event, then get event.target), then use
element.innerHTML
to get the rich text.
Upvotes: 3