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

v-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-clipboard - npm Package Compare versions

Comparing version 2.0.1 to 2.1.1

2

dist/index.min.js

@@ -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(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){if("string"!=typeof e)try{e=JSON.stringify(e)}catch(e){throw"Failed to copy value to clipboard. Unknown type."}var t=document.createElement("textarea"),r=!1;t.value=e,t.style.cssText="position:fixed;pointer-events:none;z-index:-9999;opacity:0;",document.body.appendChild(t),t.select();try{r=document.execCommand("copy")}catch(e){console.warn(e)}return document.body.removeChild(t),r};t.default={install:function(e){e.prototype.$clipboard=n;var t=function(e){return function(){return"$"+e++}}(1),r={},o=function(e){e&&(r[e]=null,delete r[e])},c=function(e){var n=t();return r[n]=e,n};e.directive("clipboard",{bind:function(e,t,o){var a=t.arg,i=t.value;switch(a){case"error":var d=c(i);return void(e.dataset.clipboardErrorHandler=d);case"success":var u=c(i);return void(e.dataset.clipboardSuccessHandler=u);default:var l=function(o){if(t.hasOwnProperty("value")){var c={value:"function"==typeof i?i():i,event:o},a=n(c.value)?e.dataset.clipboardSuccessHandler:e.dataset.clipboardErrorHandler,d=r[a];d&&d(c)}},s=c(l);return e.dataset.clipboardClickHandler=s,void e.addEventListener("click",r[s])}},unbind:function(e,t,n){var c=e.dataset,a=c.clipboardSuccessHandler,i=c.clipboardErrorHandler,d=c.clipboardClickHandler;o(a),o(i),d&&(e.removeEventListener("click",r[d]),o(d))}})}}}])});
!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(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},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 r=function(e){var t=document.createElement("textarea"),n="";if("string"!=typeof e)try{n=JSON.stringify(e)}catch(e){throw"Failed to copy value to clipboard. Unknown type."}if(t.value=n,t.setAttribute("readonly",""),t.style="position:fixed;pointer-events:none;z-index:-9999;opacity:0;",document.body.appendChild(t),navigator.userAgent.match(/ipad|ipod|iphone/i)){var r=t.contentEditable,o=t.readOnly;t.contentEditable=!0,t.readOnly=!0;var a=document.createRange();a.selectNodeContents(t);var i=window.getSelection();i.removeAllRanges(),i.addRange(a),t.setSelectionRange(0,999999),t.contentEditable=r,t.readOnly=o}else t.select();var c=!1;try{c=document.execCommand("copy")}catch(e){console.warn(e)}return document.body.removeChild(t),c};t.default={install:function(e){e.prototype.$clipboard=r;var t=function(e){return function(){return"$"+e++}}(1),n={},o=function(e){e&&(n[e]=null,delete n[e])},a=function(e){var r=t();return n[r]=e,r};e.directive("clipboard",{bind:function(e,t){var o=t.arg,i=t.value;switch(o){case"error":var c=a(i);return void(e.dataset.clipboardErrorHandler=c);case"success":var d=a(i);return void(e.dataset.clipboardSuccessHandler=d);default:var l=function(o){if(t.hasOwnProperty("value")){var a={value:"function"==typeof i?i():i,event:o},c=r(a.value)?e.dataset.clipboardSuccessHandler:e.dataset.clipboardErrorHandler,d=n[c];d&&d(a)}},u=a(l);return e.dataset.clipboardClickHandler=u,void e.addEventListener("click",n[u])}},unbind:function(e){var t=e.dataset,r=t.clipboardSuccessHandler,a=t.clipboardErrorHandler,i=t.clipboardClickHandler;o(r),o(a),i&&(e.removeEventListener("click",n[i]),o(i))}})}}}])});
//# sourceMappingURL=index.min.js.map
{
"name": "v-clipboard",
"description": "Vue.js Clipboard Plugin",
"version": "2.0.1",
"version": "2.1.1",
"author": "euvl <yev.vlasenko@gmail.com>",

@@ -6,0 +6,0 @@ "private": false,

[![npm version](https://badge.fury.io/js/v-clipboard.svg)](https://badge.fury.io/js/v-clipboard)
<p align="center">
<img width="628"
alt="Version 2.0.0"
src="https://user-images.githubusercontent.com/1577802/40780578-8c68459a-64e1-11e8-9e5c-ce147eb042cd.png">
</p>
## Vue.js Clipboard

@@ -10,0 +4,0 @@

@@ -7,6 +7,9 @@ /**

const $clipboard = text => {
if (typeof text !== "string") {
const $clipboard = input => {
const textarea = document.createElement("textarea");
let value = "";
if (typeof input !== "string") {
try {
text = JSON.stringify(text);
value = JSON.stringify(input);
} catch (e) {

@@ -17,11 +20,33 @@ throw copyErrorMessage;

const textArea = document.createElement("textarea");
let success = false;
textarea.value = value;
textarea.setAttribute("readonly", "");
textarea.style = cssText;
textArea.value = text;
textArea.style.cssText = cssText;
document.body.appendChild(textarea);
document.body.appendChild(textArea);
textArea.select();
if (navigator.userAgent.match(/ipad|ipod|iphone/i)) {
const editable = textarea.contentEditable;
const readOnly = textarea.readOnly;
textarea.contentEditable = true;
textarea.readOnly = true;
const range = document.createRange();
range.selectNodeContents(textarea);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
textarea.setSelectionRange(0, 999999);
textarea.contentEditable = editable;
textarea.readOnly = readOnly;
} else {
textarea.select();
}
let success = false;
try {

@@ -33,3 +58,3 @@ success = document.execCommand("copy");

document.body.removeChild(textArea);
document.body.removeChild(textarea);

@@ -61,3 +86,3 @@ return success;

Vue.directive("clipboard", {
bind(el, binding, vnode) {
bind(el, binding) {
const { arg, value } = binding;

@@ -105,3 +130,3 @@

unbind(el, binding, vnode) {
unbind(el) {
const {

@@ -108,0 +133,0 @@ clipboardSuccessHandler,

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

var path = require('path')
var webpack = require('webpack')
var path = require("path");
var webpack = require("webpack");
module.exports = {
entry: './src/index.js',
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'index.min.js',
library:'v-clipboard',
libraryTarget: 'umd'
path: path.resolve(__dirname, "./dist"),
publicPath: "/dist/",
filename: "index.min.js",
library: "v-clipboard",
libraryTarget: "umd"
},

@@ -17,3 +17,3 @@ module: {

test: /\.js$/,
loader: 'babel-loader',
loader: "babel-loader",
exclude: /node_modules/

@@ -26,10 +26,8 @@ }

},
devtool: '#source-map',
devtool: "#source-map",
plugins: [
new webpack.optimize.UglifyJsPlugin({
// compress: false,
// comments: false,
sourceMap: true
})
]
}
};

Sorry, the diff of this file is not supported yet

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