*
**/
Roo.util.Clipboard = {
-
- write : function(textToCopy) {
+ /**
+ * Writes a string to the clipboard - using the Clipboard API if https, otherwise using text area.
+ * @param {String} text to copy to clipboard
+ */
+ write : function(text) {
// navigator clipboard api needs a secure context (https)
if (navigator.clipboard && window.isSecureContext) {
// navigator clipboard api method'
- navigator.clipboard.writeText(textToCopy);
+ navigator.clipboard.writeText(text);
return ;
}
// text area method
var ta = document.createElement("textarea");
- ta.value = textToCopy;
+ ta.value = text;
// make the textarea out of viewport
ta.style.position = "fixed";
ta.style.left = "-999999px";