v-clipboard
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["v-clipboard"]=t():e["v-clipboard"]=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){var t=document.createElement("textarea"),n=!1;t.value=e,t.style.cssText="position:fixed;pointer-events:none;visible:hidden;",document.body.appendChild(t),t.select();try{n=document.execCommand("copy")}catch(e){}return document.body.removeChild(t),n};t.default={install:function(e){e.prototype.$clipboard=o,e.directive("clipboard",{bind:function(e,t,n){e.addEventListener("click",function(e){if(t.hasOwnProperty("value")){var r=t.value,i={value:r,srcEvent:e};o(r)?n.$emit("copy",i):n.$emit("copyError",i)}})}})}}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["v-clipboard"]=t():e["v-clipboard"]=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){var t=document.createElement("textarea"),n=!1;t.value=e,t.style.cssText="position:fixed;pointer-events:none;z-index:-9999;visibility:hidden;",document.body.appendChild(t),t.select();try{n=document.execCommand("copy")}catch(e){}return document.body.removeChild(t),n};t.default={install:function(e){e.prototype.$clipboard=o,e.directive("clipboard",{bind:function(e,t,n){e.addEventListener("click",function(e){if(t.hasOwnProperty("value")){var r=t.value,i={value:r,srcEvent:e};o(r)?n.$emit("copy",i):n.$emit("copyError",i)}})}})}}}])}); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "v-clipboard", | ||
"description": "Vue.js Clipboard Plugin", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "euvl <yev.vlasenko@gmail.com>", | ||
@@ -6,0 +6,0 @@ "private": false, |
@@ -40,1 +40,11 @@ [![npm version](https://badge.fury.io/js/v-clipboard.svg)](https://badge.fury.io/js/v-clipboard) | ||
``` | ||
### Events | ||
```vue | ||
<button v-clipboard="foo" | ||
@copy="clipboardSuccessHandler" | ||
@copy-error="clipboardErrorHandler"> | ||
Copy to clipboard | ||
</button> | ||
``` |
/** | ||
* Copyright (c) 2017 - Yev Vlasenko | ||
*/ | ||
const cssText = | ||
'position:fixed;pointer-events:none;z-index:-9999;visibility:hidden;' | ||
const copy = (text) => { | ||
@@ -9,4 +12,3 @@ let textArea = document.createElement("textarea") | ||
textArea.value = text | ||
textArea.style.cssText = | ||
'position:fixed;pointer-events:none;visible:hidden;' | ||
textArea.style.cssText = cssText | ||
@@ -13,0 +15,0 @@ document.body.appendChild(textArea) |
Sorry, the diff of this file is not supported yet
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
15881
76
50