1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 02:07:59 +01:00

new liberator.util.readFromClipboard, so also non-Firefox extensions have access to the clipboard

This commit is contained in:
Martin Stubenschrott
2008-05-05 13:22:55 +00:00
parent 7b7d39cc8d
commit 04004ebb39
7 changed files with 49 additions and 22 deletions

View File

@@ -378,7 +378,7 @@ liberator.Editor = function () //{{{
{
var sel = window.content.document.getSelection();
if (sel)
liberator.copyToClipboard(sel, true);
liberator.util.copyToClipboard(sel, true);
else
liberator.beep();
}
@@ -494,14 +494,14 @@ liberator.Editor = function () //{{{
{
var elt = window.document.commandDispatcher.focusedElement;
if (elt.setSelectionRange && readFromClipboard())
if (elt.setSelectionRange && liberator.util.readFromClipboard())
// readFromClipboard would return 'undefined' if not checked
// dunno about .setSelectionRange
{
var rangeStart = elt.selectionStart; // caret position
var rangeEnd = elt.selectionEnd;
var tempStr1 = elt.value.substring(0, rangeStart);
var tempStr2 = readFromClipboard();
var tempStr2 = liberator.util.readFromClipboard();
var tempStr3 = elt.value.substring(rangeEnd);
elt.value = tempStr1 + tempStr2 + tempStr3;
elt.selectionStart = rangeStart + tempStr2.length;