Issue 141, get the correct selection across frames and editable documents.

This commit is contained in:
amla70
2010-08-02 10:41:51 +00:00
parent 6971a70671
commit 9cf9aa3479

View File

@@ -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: