copy-component
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -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", { |
{ | ||
"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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5397
107
0