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

stimulus-clipboard

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

stimulus-clipboard - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

6

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## [3.2.2]
### Chore
- Allow `sourceTarget` to be any HTML element to copy its `innerHTML`.
## [3.2.1]

@@ -11,0 +17,0 @@

3

dist/stimulus-clipboard.es.js

@@ -10,3 +10,4 @@ import { Controller } from "@hotwired/stimulus";

event.preventDefault();
navigator.clipboard.writeText(this.sourceTarget.value).then(() => this.copied());
const text = this.sourceTarget.innerHTML || this.sourceTarget.value;
navigator.clipboard.writeText(text).then(() => this.copied());
}

@@ -13,0 +14,0 @@ copied() {

@@ -1,1 +0,1 @@

(function(e,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t(require("@hotwired/stimulus")):typeof define=="function"&&define.amd?define(["@hotwired/stimulus"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,e["stimulus-clipboard"]=t(e.Stimulus))})(this,function(e){"use strict";class t extends e.Controller{connect(){!this.hasButtonTarget||(this.originalContent=this.buttonTarget.innerHTML)}copy(i){i.preventDefault(),navigator.clipboard.writeText(this.sourceTarget.value).then(()=>this.copied())}copied(){!this.hasButtonTarget||(this.timeout&&clearTimeout(this.timeout),this.buttonTarget.innerText=this.data.get("successContent"),this.timeout=setTimeout(()=>{this.buttonTarget.innerHTML=this.originalContent},this.successDurationValue))}}return t.targets=["button","source"],t.values={successDuration:{type:Number,default:2e3}},t});
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t(require("@hotwired/stimulus")):typeof define=="function"&&define.amd?define(["@hotwired/stimulus"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,e["stimulus-clipboard"]=t(e.Stimulus))})(this,function(e){"use strict";class t extends e.Controller{connect(){!this.hasButtonTarget||(this.originalContent=this.buttonTarget.innerHTML)}copy(i){i.preventDefault();const s=this.sourceTarget.innerHTML||this.sourceTarget.value;navigator.clipboard.writeText(s).then(()=>this.copied())}copied(){!this.hasButtonTarget||(this.timeout&&clearTimeout(this.timeout),this.buttonTarget.innerText=this.data.get("successContent"),this.timeout=setTimeout(()=>{this.buttonTarget.innerHTML=this.originalContent},this.successDurationValue))}}return t.targets=["button","source"],t.values={successDuration:{type:Number,default:2e3}},t});
{
"name": "stimulus-clipboard",
"version": "3.2.1",
"version": "3.2.2",
"description": "A Stimulus controller to copy text to clipboard.",

@@ -5,0 +5,0 @@ "keywords": [

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