v-clipboard
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -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");t.style.cssText="position:fixed;pointer-events:none;visible:hidden;",t.value=e,document.body.appendChild(t),t.select();var n=!1;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;o(r)?n.$emit("copy",r):n.$emit("copyError")}})}})}}}])}); | ||
!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)}})}})}}}])}); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "v-clipboard", | ||
"description": "Vue.js Clipboard Plugin", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "euvl <yev.vlasenko@gmail.com>", | ||
@@ -6,0 +6,0 @@ "private": false, |
@@ -0,1 +1,3 @@ | ||
[![npm version](https://badge.fury.io/js/v-clipboard.svg)](https://badge.fury.io/js/v-clipboard) | ||
## Vue.js Clipboard plugin | ||
@@ -2,0 +4,0 @@ |
@@ -5,7 +5,8 @@ /** | ||
const copy = (text) => { | ||
var textArea = document.createElement("textarea") | ||
let textArea = document.createElement("textarea") | ||
let success = false | ||
textArea.value = text | ||
textArea.style.cssText = | ||
'position:fixed;pointer-events:none;visible:hidden;' | ||
textArea.value = text | ||
@@ -15,4 +16,2 @@ document.body.appendChild(textArea) | ||
let success = false | ||
try { | ||
@@ -36,7 +35,8 @@ success = document.execCommand('copy') | ||
if (binding.hasOwnProperty('value')) { | ||
let value = binding.value | ||
let { value } = binding | ||
let payload = { value, srcEvent: event } | ||
copy(value) | ||
? vnode.$emit('copy', value) | ||
: vnode.$emit('copyError') | ||
? vnode.$emit('copy', payload) | ||
: vnode.$emit('copyError', payload) | ||
} | ||
@@ -43,0 +43,0 @@ }) |
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
15573
75
40