mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-20 00:45:49 +01:00
Revert "Replace use of editor.pasteClipboard with executeCommand("cmd_paste")."
This reverts commit 7e8db4743b24368ba1784420e6cdf6b4838958df. The commit breaks selection pasting in linux, so reverting.
This commit is contained in:
@@ -339,7 +339,7 @@ function Editor() //{{{
|
|||||||
|
|
||||||
mappings.add(myModes,
|
mappings.add(myModes,
|
||||||
["<S-Insert>"], "Insert clipboard/selection",
|
["<S-Insert>"], "Insert clipboard/selection",
|
||||||
function () { editor.executeCommand("cmd_paste"); });
|
function () { editor.pasteClipboard(); });
|
||||||
|
|
||||||
mappings.add([modes.INSERT, modes.TEXTAREA, modes.COMPOSE],
|
mappings.add([modes.INSERT, modes.TEXTAREA, modes.COMPOSE],
|
||||||
["<C-i>"], "Edit text field with an external editor",
|
["<C-i>"], "Edit text field with an external editor",
|
||||||
@@ -621,6 +621,25 @@ function Editor() //{{{
|
|||||||
return text.substring(getEditor().selectionStart, getEditor().selectionEnd);
|
return text.substring(getEditor().selectionStart, getEditor().selectionEnd);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
pasteClipboard: function ()
|
||||||
|
{
|
||||||
|
let elem = window.document.commandDispatcher.focusedElement;
|
||||||
|
|
||||||
|
if (elem.setSelectionRange && util.readFromClipboard())
|
||||||
|
// readFromClipboard would return 'undefined' if not checked
|
||||||
|
// dunno about .setSelectionRange
|
||||||
|
{
|
||||||
|
let rangeStart = elem.selectionStart; // caret position
|
||||||
|
let rangeEnd = elem.selectionEnd;
|
||||||
|
let tempStr1 = elem.value.substring(0, rangeStart);
|
||||||
|
let tempStr2 = util.readFromClipboard();
|
||||||
|
let tempStr3 = elem.value.substring(rangeEnd);
|
||||||
|
elem.value = tempStr1 + tempStr2 + tempStr3;
|
||||||
|
elem.selectionStart = rangeStart + tempStr2.length;
|
||||||
|
elem.selectionEnd = elem.selectionStart;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// count is optional, defaults to 1
|
// count is optional, defaults to 1
|
||||||
executeCommand: function (cmd, count)
|
executeCommand: function (cmd, count)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user