mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 18:44:14 +01:00
Register support with a crude kill ring.
This commit is contained in:
@@ -339,16 +339,20 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
* This is same as Firefox's readFromClipboard function, but is needed for
|
||||
* apps like Thunderbird which do not provide it.
|
||||
*
|
||||
* @param {string} which Which clipboard to write to. Either
|
||||
* "global" or "selection". If not provided, both clipboards are
|
||||
* updated.
|
||||
* @optional
|
||||
* @returns {string}
|
||||
*/
|
||||
clipboardRead: function clipboardRead(getClipboard) {
|
||||
clipboardRead: function clipboardRead(which) {
|
||||
try {
|
||||
const { clipboard } = services;
|
||||
|
||||
let transferable = services.Transferable();
|
||||
transferable.addDataFlavor("text/unicode");
|
||||
|
||||
let source = clipboard[getClipboard || !clipboard.supportsSelectionClipboard() ?
|
||||
let source = clipboard[which == "global" || !clipboard.supportsSelectionClipboard() ?
|
||||
"kGlobalClipboard" : "kSelectionClipboard"];
|
||||
clipboard.getData(transferable, source);
|
||||
|
||||
@@ -375,7 +379,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
* @optional
|
||||
*/
|
||||
clipboardWrite: function clipboardWrite(str, verbose, which) {
|
||||
if (!which)
|
||||
if (which == null)
|
||||
services.clipboardHelper.copyString(str);
|
||||
else if (which == "selection" && !services.clipboard.supportsSelectionClipboard())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user