New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ngx-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-clipboard - npm Package Compare versions

Comparing version 6.0.0-beta6 to 6.0.0-beta7

20

dist/bundles/ngxClipboard.umd.js

@@ -8,3 +8,7 @@ (function (global, factory) {

var ClipboardService = (function () {
function ClipboardService() {
/**
* @param {?} document
*/
function ClipboardService(document) {
this.document = document;
}

@@ -16,3 +20,3 @@ Object.defineProperty(ClipboardService.prototype, "isSupported", {

get: function () {
return !!document.queryCommandSupported && !!document.queryCommandSupported('copy');
return !!this.document.queryCommandSupported && !!this.document.queryCommandSupported('copy');
},

@@ -56,4 +60,4 @@ enumerable: true,

if (!this.tempTextArea) {
this.tempTextArea = this.createTempTextArea(document, window);
document.body.appendChild(this.tempTextArea);
this.tempTextArea = this.createTempTextArea(this.document, window);
this.document.body.appendChild(this.tempTextArea);
}

@@ -68,3 +72,3 @@ this.tempTextArea.value = content;

if (this.tempTextArea) {
document.body.removeChild(this.tempTextArea);
this.document.body.removeChild(this.tempTextArea);
this.tempTextArea = undefined;

@@ -92,3 +96,3 @@ }

// TODO: shouldn't use document directly
return document.execCommand('copy');
return this.document.execCommand('copy');
}

@@ -141,3 +145,5 @@ catch (err) {

*/
ClipboardService.ctorParameters = function () { return []; };
ClipboardService.ctorParameters = function () { return [
{ type: Document, },
]; };

@@ -144,0 +150,0 @@ var ClipboardDirective = (function () {

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

(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("@angular/platform-browser"),require("@angular/core")):typeof define==="function"&&define.amd?define(["exports","@angular/platform-browser","@angular/core"],factory):factory((global.ngx=global.ngx||{},global.ngx.clipboard=global.ngx.clipboard||{}),global._angular_platformBrowser,global.ng.core)})(this,function(exports,_angular_platformBrowser,_angular_core){"use strict";var ClipboardService=function(){function ClipboardService(){}Object.defineProperty(ClipboardService.prototype,"isSupported",{get:function(){return!!document.queryCommandSupported&&!!document.queryCommandSupported("copy")},enumerable:true,configurable:true});ClipboardService.prototype.isTargetValid=function(element){if(element&&typeof element==="object"&&element.nodeType===1){if(element.hasAttribute("disabled")){throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute')}return true}throw new Error('Invalid "target" value, use a valid Element')};ClipboardService.prototype.copyFromInputElement=function(targetElm,renderer){this.selectTarget(targetElm,renderer);var re=this.copyText();this.clearSelection(targetElm,window);return re};ClipboardService.prototype.copyFromContent=function(content,renderer){if(!this.tempTextArea){this.tempTextArea=this.createTempTextArea(document,window);document.body.appendChild(this.tempTextArea)}this.tempTextArea.value=content;return this.copyFromInputElement(this.tempTextArea,renderer)};ClipboardService.prototype.destroy=function(){if(this.tempTextArea){document.body.removeChild(this.tempTextArea);this.tempTextArea=undefined}};ClipboardService.prototype.selectTarget=function(inputElement,renderer){if(inputElement.nodeName==="INPUT"||inputElement.nodeName==="TEXTAREA"){renderer.invokeElementMethod(inputElement,"select");renderer.invokeElementMethod(inputElement,"setSelectionRange",[0,inputElement.value.length])}};ClipboardService.prototype.copyText=function(){try{return document.execCommand("copy")}catch(err){throw new Error("Fail to perform copy")}};ClipboardService.prototype.clearSelection=function(inputElement,window){inputElement&&inputElement.blur();window.getSelection().removeAllRanges()};ClipboardService.prototype.createTempTextArea=function(doc,window){var isRTL=doc.documentElement.getAttribute("dir")==="rtl";var ta;ta=doc.createElement("textarea");ta.style.fontSize="12pt";ta.style.border="0";ta.style.padding="0";ta.style.margin="0";ta.style.position="absolute";ta.style[isRTL?"right":"left"]="-9999px";var yPosition=window.pageYOffset||doc.documentElement.scrollTop;ta.style.top=yPosition+"px";ta.setAttribute("readonly","");return ta};return ClipboardService}();ClipboardService.decorators=[{type:_angular_core.Injectable}];ClipboardService.ctorParameters=function(){return[]};var ClipboardDirective=function(){function ClipboardDirective(clipboardSrv,renderer){this.clipboardSrv=clipboardSrv;this.renderer=renderer;this.cbOnSuccess=new _angular_core.EventEmitter;this.cbOnError=new _angular_core.EventEmitter}ClipboardDirective.prototype.ngOnInit=function(){if(!this.clipboardSrv.isSupported){throw new Error("Your environment does not support copy.")}};ClipboardDirective.prototype.ngOnDestroy=function(){this.clipboardSrv.destroy()};ClipboardDirective.prototype.onClick=function(button){if(this.targetElm&&this.clipboardSrv.isTargetValid(this.targetElm)){this.handleResult(this.clipboardSrv.copyFromInputElement(this.targetElm,this.renderer),this.targetElm.value)}else if(this.cbContent){this.handleResult(this.clipboardSrv.copyFromContent(this.cbContent,this.renderer),this.cbContent)}else{throw new Error("Expecting a HtmlInputElement for ngxClipboard or a string value for cbContent.")}};ClipboardDirective.prototype.handleResult=function(succeeded,copiedContent){if(succeeded){this.cbOnSuccess.emit({isSuccess:true,content:copiedContent})}else{this.cbOnError.emit({isSuccess:false})}};return ClipboardDirective}();ClipboardDirective.decorators=[{type:_angular_core.Directive,args:[{selector:"[ngxClipboard]"}]}];ClipboardDirective.ctorParameters=function(){return[{type:ClipboardService},{type:_angular_core.Renderer}]};ClipboardDirective.propDecorators={targetElm:[{type:_angular_core.Input,args:["ngxClipboard"]}],cbContent:[{type:_angular_core.Input}],cbOnSuccess:[{type:_angular_core.Output}],cbOnError:[{type:_angular_core.Output}],onClick:[{type:_angular_core.HostListener,args:["click",["$event.target"]]}]};var ClipboardModule=function(){function ClipboardModule(){}return ClipboardModule}();ClipboardModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[ClipboardDirective],exports:[ClipboardDirective],imports:[_angular_platformBrowser.BrowserModule],providers:[ClipboardService]}]}];ClipboardModule.ctorParameters=function(){return[]};exports.ClipboardModule=ClipboardModule;exports.ClipboardDirective=ClipboardDirective;Object.defineProperty(exports,"__esModule",{value:true})});
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("@angular/platform-browser"),require("@angular/core")):typeof define==="function"&&define.amd?define(["exports","@angular/platform-browser","@angular/core"],factory):factory((global.ngx=global.ngx||{},global.ngx.clipboard=global.ngx.clipboard||{}),global._angular_platformBrowser,global.ng.core)})(this,function(exports,_angular_platformBrowser,_angular_core){"use strict";var ClipboardService=function(){function ClipboardService(document){this.document=document}Object.defineProperty(ClipboardService.prototype,"isSupported",{get:function(){return!!this.document.queryCommandSupported&&!!this.document.queryCommandSupported("copy")},enumerable:true,configurable:true});ClipboardService.prototype.isTargetValid=function(element){if(element&&typeof element==="object"&&element.nodeType===1){if(element.hasAttribute("disabled")){throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute')}return true}throw new Error('Invalid "target" value, use a valid Element')};ClipboardService.prototype.copyFromInputElement=function(targetElm,renderer){this.selectTarget(targetElm,renderer);var re=this.copyText();this.clearSelection(targetElm,window);return re};ClipboardService.prototype.copyFromContent=function(content,renderer){if(!this.tempTextArea){this.tempTextArea=this.createTempTextArea(this.document,window);this.document.body.appendChild(this.tempTextArea)}this.tempTextArea.value=content;return this.copyFromInputElement(this.tempTextArea,renderer)};ClipboardService.prototype.destroy=function(){if(this.tempTextArea){this.document.body.removeChild(this.tempTextArea);this.tempTextArea=undefined}};ClipboardService.prototype.selectTarget=function(inputElement,renderer){if(inputElement.nodeName==="INPUT"||inputElement.nodeName==="TEXTAREA"){renderer.invokeElementMethod(inputElement,"select");renderer.invokeElementMethod(inputElement,"setSelectionRange",[0,inputElement.value.length])}};ClipboardService.prototype.copyText=function(){try{return this.document.execCommand("copy")}catch(err){throw new Error("Fail to perform copy")}};ClipboardService.prototype.clearSelection=function(inputElement,window){inputElement&&inputElement.blur();window.getSelection().removeAllRanges()};ClipboardService.prototype.createTempTextArea=function(doc,window){var isRTL=doc.documentElement.getAttribute("dir")==="rtl";var ta;ta=doc.createElement("textarea");ta.style.fontSize="12pt";ta.style.border="0";ta.style.padding="0";ta.style.margin="0";ta.style.position="absolute";ta.style[isRTL?"right":"left"]="-9999px";var yPosition=window.pageYOffset||doc.documentElement.scrollTop;ta.style.top=yPosition+"px";ta.setAttribute("readonly","");return ta};return ClipboardService}();ClipboardService.decorators=[{type:_angular_core.Injectable}];ClipboardService.ctorParameters=function(){return[{type:Document}]};var ClipboardDirective=function(){function ClipboardDirective(clipboardSrv,renderer){this.clipboardSrv=clipboardSrv;this.renderer=renderer;this.cbOnSuccess=new _angular_core.EventEmitter;this.cbOnError=new _angular_core.EventEmitter}ClipboardDirective.prototype.ngOnInit=function(){if(!this.clipboardSrv.isSupported){throw new Error("Your environment does not support copy.")}};ClipboardDirective.prototype.ngOnDestroy=function(){this.clipboardSrv.destroy()};ClipboardDirective.prototype.onClick=function(button){if(this.targetElm&&this.clipboardSrv.isTargetValid(this.targetElm)){this.handleResult(this.clipboardSrv.copyFromInputElement(this.targetElm,this.renderer),this.targetElm.value)}else if(this.cbContent){this.handleResult(this.clipboardSrv.copyFromContent(this.cbContent,this.renderer),this.cbContent)}else{throw new Error("Expecting a HtmlInputElement for ngxClipboard or a string value for cbContent.")}};ClipboardDirective.prototype.handleResult=function(succeeded,copiedContent){if(succeeded){this.cbOnSuccess.emit({isSuccess:true,content:copiedContent})}else{this.cbOnError.emit({isSuccess:false})}};return ClipboardDirective}();ClipboardDirective.decorators=[{type:_angular_core.Directive,args:[{selector:"[ngxClipboard]"}]}];ClipboardDirective.ctorParameters=function(){return[{type:ClipboardService},{type:_angular_core.Renderer}]};ClipboardDirective.propDecorators={targetElm:[{type:_angular_core.Input,args:["ngxClipboard"]}],cbContent:[{type:_angular_core.Input}],cbOnSuccess:[{type:_angular_core.Output}],cbOnError:[{type:_angular_core.Output}],onClick:[{type:_angular_core.HostListener,args:["click",["$event.target"]]}]};var ClipboardModule=function(){function ClipboardModule(){}return ClipboardModule}();ClipboardModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[ClipboardDirective],exports:[ClipboardDirective],imports:[_angular_platformBrowser.BrowserModule],providers:[ClipboardService]}]}];ClipboardModule.ctorParameters=function(){return[]};exports.ClipboardModule=ClipboardModule;exports.ClipboardDirective=ClipboardDirective;Object.defineProperty(exports,"__esModule",{value:true})});
import { Injectable } from '@angular/core';
var ClipboardService = (function () {
function ClipboardService() {
/**
* @param {?} document
*/
function ClipboardService(document) {
this.document = document;
}

@@ -10,3 +14,3 @@ Object.defineProperty(ClipboardService.prototype, "isSupported", {

get: function () {
return !!document.queryCommandSupported && !!document.queryCommandSupported('copy');
return !!this.document.queryCommandSupported && !!this.document.queryCommandSupported('copy');
},

@@ -50,4 +54,4 @@ enumerable: true,

if (!this.tempTextArea) {
this.tempTextArea = this.createTempTextArea(document, window);
document.body.appendChild(this.tempTextArea);
this.tempTextArea = this.createTempTextArea(this.document, window);
this.document.body.appendChild(this.tempTextArea);
}

@@ -62,3 +66,3 @@ this.tempTextArea.value = content;

if (this.tempTextArea) {
document.body.removeChild(this.tempTextArea);
this.document.body.removeChild(this.tempTextArea);
this.tempTextArea = undefined;

@@ -86,3 +90,3 @@ }

// TODO: shouldn't use document directly
return document.execCommand('copy');
return this.document.execCommand('copy');
}

@@ -136,3 +140,5 @@ catch (err) {

*/
ClipboardService.ctorParameters = function () { return []; };
ClipboardService.ctorParameters = function () { return [
{ type: Document, },
]; };
function ClipboardService_tsickle_Closure_declarations() {

@@ -148,3 +154,5 @@ /** @type {?} */

ClipboardService.prototype.tempTextArea;
/** @type {?} */
ClipboardService.prototype.document;
}
//# sourceMappingURL=clipboard.service.js.map

@@ -6,3 +6,3 @@ {

"module": "./dist/index.js",
"version": "6.0.0-beta6",
"version": "6.0.0-beta7",
"author": {

@@ -9,0 +9,0 @@ "name": "Sam Lin",

@@ -9,3 +9,3 @@ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)

Angular directive for [clipboard.js](http://zenorocha.github.io/clipboard.js/) by [@zenorocha](https://twitter.com/zenorocha)
From 6.0.0, there is no dependency anymore. Just Angular.

@@ -19,3 +19,2 @@ It works with angular version 2.0.0 and up

+ Angular >=2.0.0
+ [clipboard.js](https://clipboardjs.com/)

@@ -44,3 +43,3 @@ ## Install

map: {
'ngx-clipboard': 'node_modules/ngx-clipboard/dist/bundles/ngxClipboard.umd.min.js'
'ngx-clipboard': 'node_modules/ngx-clipboard'
}

@@ -75,4 +74,6 @@ });

[Thierry Templier](http://stackoverflow.com/a/36330518/667767) This project is base on his answer on StackOverflow
[Thierry Templier](http://stackoverflow.com/a/36330518/667767) This project is inspired by his answer on StackOverflow.
[blacksonic](https://github.com/blacksonic/ngx-aot-webpack) AoT's demo is based on his project
The core function is ported from [clipboard.js](http://zenorocha.github.io/clipboard.js/) by [@zenorocha](https://twitter.com/zenorocha).
[blacksonic](https://github.com/blacksonic/ngx-aot-webpack) AoT's demo is based on his project.

@@ -7,4 +7,9 @@ import { Injectable, Renderer } from '@angular/core';

constructor(
private document: Document
) {
}
public get isSupported(): boolean {
return !!document.queryCommandSupported && !!document.queryCommandSupported('copy');
return !!this.document.queryCommandSupported && !!this.document.queryCommandSupported('copy');
}

@@ -38,4 +43,4 @@

if (!this.tempTextArea) {
this.tempTextArea = this.createTempTextArea(document, window);
document.body.appendChild(this.tempTextArea);
this.tempTextArea = this.createTempTextArea(this.document, window);
this.document.body.appendChild(this.tempTextArea);
}

@@ -49,3 +54,3 @@ this.tempTextArea.value = content;

if (this.tempTextArea) {
document.body.removeChild(this.tempTextArea);
this.document.body.removeChild(this.tempTextArea);
this.tempTextArea = undefined;

@@ -68,3 +73,3 @@ }

// TODO: shouldn't use document directly
return document.execCommand('copy');
return this.document.execCommand('copy');
} catch (err) {

@@ -71,0 +76,0 @@ throw new Error('Fail to perform copy');

@@ -6,3 +6,3 @@ import { BrowserModule } from '@angular/platform-browser';

export * from './clipboard.directive';
export { ClipboardService } from './clipboard.service';
export * from './clipboard.service';

@@ -9,0 +9,0 @@

Sorry, the diff of this file is not supported yet

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