mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Issue 141, get the correct selection across frames and editable documents.
This commit is contained in:
@@ -58,13 +58,17 @@ var sendtophone = {
|
|||||||
case 'text':
|
case 'text':
|
||||||
title = "Selection";
|
title = "Selection";
|
||||||
url = 'http://www.google.com/';
|
url = 'http://www.google.com/';
|
||||||
if (gContextMenu.onTextInput)
|
var input = gContextMenu.target;
|
||||||
|
if (gContextMenu.onTextInput && input && input.value)
|
||||||
{
|
{
|
||||||
var input = gContextMenu.target;
|
|
||||||
selection = input.value.substring(input.selectionStart, input.selectionEnd);
|
selection = input.value.substring(input.selectionStart, input.selectionEnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
selection = content.getSelection().toString();
|
{
|
||||||
|
// Get the selection from the correct iframe
|
||||||
|
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||||
|
selection = focusedWindow.getSelection().toString();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'page':
|
case 'page':
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user