Comparing version 1.0.1 to 1.0.2
16
index.js
@@ -17,12 +17,12 @@ export async function clippie(content) { | ||
if (!document.execCommand) return false; | ||
const tempTextArea = document.createElement("textarea"); | ||
tempTextArea.value = text; | ||
tempTextArea.style.top = 0; | ||
tempTextArea.style.left = 0; | ||
tempTextArea.style.position = "fixed"; | ||
document.body.appendChild(tempTextArea); | ||
tempTextArea.select(); | ||
const el = document.createElement("textarea"); | ||
el.value = text; | ||
el.style.top = 0; | ||
el.style.left = 0; | ||
el.style.position = "fixed"; | ||
document.body.appendChild(el); | ||
el.select(); | ||
const success = document.execCommand("copy"); | ||
document.body.removeChild(tempTextArea); | ||
document.body.removeChild(el); | ||
return success; | ||
} |
{ | ||
"name": "clippie", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Teeny-tiny browser clipboard copy", | ||
@@ -5,0 +5,0 @@ "author": "silverwind", |
@@ -15,3 +15,3 @@ # clippie | ||
// copy blob, also works with images | ||
const success = await clippie(new Blob("text to copy"), "text/plain"); | ||
const success = await clippie(new Blob("text to copy", "text/plain")); | ||
``` | ||
@@ -18,0 +18,0 @@ |
2120