fune/browser/extensions/screenshots/webextension/clipboard.js
Jared Hirsch 47db4ca0b0 Bug 1361208 - import latest version of Screenshots (6.6.0) into the tree; r=standard8
MozReview-Commit-ID: DICbgINxnoa

--HG--
extra : rebase_source : 065193b99216d68cf7f3ab3a41944f3d2a0836eb
2017-05-01 16:58:23 -07:00

23 lines
471 B
JavaScript

/* globals catcher */
"use strict";
this.clipboard = (function() {
let exports = {};
exports.copy = function(text) {
let el = document.createElement("textarea");
document.body.appendChild(el);
el.value = text;
el.select();
const copied = document.execCommand("copy");
document.body.removeChild(el);
if (!copied) {
catcher.unhandled(new Error("Clipboard copy failed"));
}
return copied;
};
return exports;
})();
null;