cytoscape-clipboard
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -17,3 +17,7 @@ ;(function () { | ||
var options = { | ||
clipboardSize: 0 | ||
clipboardSize: 0, | ||
beforeCopy: null, | ||
afterCopy: null, | ||
beforePaste: null, | ||
afterPaste: null | ||
}; | ||
@@ -99,3 +103,9 @@ | ||
if(options.beforeCopy) { | ||
options.beforeCopy(nodes.union(edges)); | ||
} | ||
clipboard[id] = {nodes: nodes.jsons(), edges: edges.jsons()}; | ||
if(options.afterCopy) { | ||
options.afterCopy(clipboard[id]); | ||
} | ||
return id; | ||
@@ -106,2 +116,5 @@ }, | ||
var res = cy.collection(); | ||
if(options.beforePaste) { | ||
options.beforePaste(clipboard[id]); | ||
} | ||
if (clipboard[id]) { | ||
@@ -117,2 +130,5 @@ var nodes = changeIds(clipboard[id].nodes); | ||
} | ||
if(options.afterPaste) { | ||
options.afterPaste(res); | ||
} | ||
return res; | ||
@@ -119,0 +135,0 @@ } |
{ | ||
"name": "cytoscape-clipboard", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Adds copy-paste utilities to cytoscape.", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-clipboard.js", |
@@ -32,3 +32,22 @@ cytoscape-clipboard | ||
var options = { | ||
clipboardSize: 0 | ||
clipboardSize: 0, | ||
// The following 4 options allow the user to provide custom behavior to | ||
// the extension. They can be used to maintain consistency of some data | ||
// when elements are duplicated. | ||
// These 4 options are set to null by default. The function prototypes | ||
// are provided below for explanation purpose only. | ||
// Function executed on the collection of elements being copied, before | ||
// they are serialized in the clipboard | ||
beforeCopy: function(eles) {}, | ||
// Function executed on the clipboard just after the elements are copied. | ||
// clipboard is of the form: {nodes: json, edges: json} | ||
afterCopy: function(clipboard) {}, | ||
// Function executed on the clipboard right before elements are pasted, | ||
// when they are still in the clipboard. | ||
beforePaste: function(clipboard) {}, | ||
// Function executed on the collection of pasted elements, after they | ||
// are pasted. | ||
afterPaste: function(eles) {} | ||
}; | ||
@@ -35,0 +54,0 @@ ``` |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
33149
617
107
2