Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clippie

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clippie - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

30

index.js

@@ -11,3 +11,15 @@ export async function clippie(content, {reject = false} = {}) {

} catch {
return fallback(c);
if (!document.execCommand) return false;
const el = document.createElement("textarea");
el.value = c;
el.style.top = 0;
el.style.left = 0;
el.style.position = "fixed";
el.style.clip = "rect(0, 0, 0, 0)";
el.ariaHidden = "true";
document.body.appendChild(el);
el.select();
const success = document.execCommand("copy");
document.body.removeChild(el);
return success;
}

@@ -22,17 +34,1 @@ }

}
function fallback(text) {
if (!document.execCommand) return false;
const el = document.createElement("textarea");
el.value = text;
el.style.top = 0;
el.style.left = 0;
el.style.position = "fixed";
el.style.clip = "rect(0, 0, 0, 0)";
el.ariaHidden = "true";
document.body.appendChild(el);
el.select();
const success = document.execCommand("copy");
document.body.removeChild(el);
return success;
}
{
"name": "clippie",
"version": "3.1.0",
"version": "3.1.1",
"description": "Teeny-tiny browser clipboard copy",

@@ -5,0 +5,0 @@ "author": "silverwind",

@@ -21,12 +21,12 @@ # clippie

- `content` *String*, *Blob*, *Array*: Content to copy. If an Array is passed, will copy all items in sequence.
- `content` *String*, *Blob*, *Array[String,Blob]*: Content to copy. If an Array is passed, will copy all items in sequence.
- `options` *Object*
- `reject`: *Boolean*: Whether to reject on unexpected errors. Default: `false`.
Returns `true` when successful and `false` when not. Will never throw.
Returns `true` when successful and `false` when not. Will never throw unless `reject` is `true`.
## Notes
To enable image copy in Firefox, enable `dom.events.asyncClipboard.clipboardItem` in `about:config`. Track [Bug 1619947](https://bugzilla.mozilla.org/show_bug.cgi?id=1619947) for updates.
Firefox needs `dom.events.asyncClipboard.clipboardItem` in `about:config` to enable image copying. Track [Bug 1619947](https://bugzilla.mozilla.org/show_bug.cgi?id=1619947) for updates.
© [silverwind](https://github.com/silverwind), distributed under BSD licence
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc