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

copy-component

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-component - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

25

CopyComponent.js

@@ -1,3 +0,8 @@

const copyText = async (element) => {
const copyText = async (elements) => {
// Copy to the clipboard
const doc = document.createDocumentFragment();
const element = document.createElement("div");
doc.appendChild(element);
elements.forEach((el) => element.appendChild(el.cloneNode(true)));
if ("clipboard" in navigator) {

@@ -38,10 +43,10 @@ try {

template.innerHTML = `
<style>
:host {
display: block;
}
</style>
<slot></slot>
<slot name="button"></slot>
`;
<style>
:host {
display: block;
}
</style>
<slot></slot>
<slot name="button"></slot>
`;

@@ -88,3 +93,3 @@ export class CopyComponent extends HTMLElement {

try {
await copyText(slottedElements[0]);
await copyText(slottedElements);
this.dispatchEvent(

@@ -91,0 +96,0 @@ new CustomEvent("copy", {

2

package.json
{
"name": "copy-component",
"version": "0.1.0",
"version": "0.2.0",
"description": "A vanilla custom element that adds the capability to wrap html so it the inner text can be added to the users clipboard",

@@ -5,0 +5,0 @@ "main": "index.js",

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