stimulus-clipboard
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -9,5 +9,14 @@ # Changelog | ||
## [3.2.1] | ||
### Chore | ||
- Use innerHTML for originalContent, so icons can be used (https://github.com/stimulus-components/stimulus-clipboard/pull/8) | ||
- Bump dependencies. | ||
## [3.2.0] | ||
### Chore | ||
- Bump dependencies. | ||
- Using Clipboard API over execCommand. | ||
@@ -14,0 +23,0 @@ |
@@ -6,3 +6,3 @@ import { Controller } from "@hotwired/stimulus"; | ||
return; | ||
this.originalText = this.buttonTarget.innerText; | ||
this.originalContent = this.buttonTarget.innerHTML; | ||
} | ||
@@ -21,3 +21,3 @@ copy(event) { | ||
this.timeout = setTimeout(() => { | ||
this.buttonTarget.innerText = this.originalText; | ||
this.buttonTarget.innerHTML = this.originalContent; | ||
}, this.successDurationValue); | ||
@@ -24,0 +24,0 @@ } |
@@ -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.originalText=this.buttonTarget.innerText)}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.innerText=this.originalText},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(),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}); |
{ | ||
"name": "stimulus-clipboard", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "A Stimulus controller to copy text to clipboard.", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"dev": "vite", | ||
"prod": "vite build --config /dev/null", | ||
"prod": "vite build --mode netlify", | ||
"build": "tsc --noEmit && vite build", | ||
@@ -33,15 +33,15 @@ "version": "yarn build", | ||
"devDependencies": { | ||
"@babel/core": "7.18.5", | ||
"@babel/core": "7.19.6", | ||
"@babel/plugin-syntax-class-properties": "7.12.13", | ||
"@babel/preset-env": "^7.18.2", | ||
"@babel/preset-typescript": "^7.17.12", | ||
"@hotwired/stimulus": "^3.0.1", | ||
"np": "^7.6.1", | ||
"@babel/preset-env": "^7.19.4", | ||
"@babel/preset-typescript": "^7.18.6", | ||
"@hotwired/stimulus": "^3.1.0", | ||
"np": "^7.6.2", | ||
"prettier-standard": "16.4.1", | ||
"typescript": "^4.7.4", | ||
"typescript": "^4.8.4", | ||
"vite": "^2.9.12" | ||
}, | ||
"peerDependencies": { | ||
"@hotwired/stimulus": "^3.0.0" | ||
"@hotwired/stimulus": "^3.1.0" | ||
} | ||
} |
@@ -15,3 +15,3 @@ # Stimulus Clipboard | ||
See [stimulus-clipboard documentation](https://stimulus-components.netlify.app/docs/components/stimulus-clipboard/). | ||
See [stimulus-clipboard documentation](https://www.stimulus-components.com/docs/stimulus-clipboard/). | ||
@@ -18,0 +18,0 @@ ## 👷♂️ Contributing |
6594