cytoscape-clipboard
Advanced tools
Comparing version 2.0.4 to 2.1.0
@@ -5,5 +5,5 @@ ;(function () { | ||
// registers the extension on a cytoscape lib ref | ||
var register = function (cytoscape, $) { | ||
var register = function (cytoscape) { | ||
if (!cytoscape || !$) { | ||
if (!cytoscape) { | ||
return; | ||
@@ -17,13 +17,2 @@ } // can't register if cytoscape unspecified | ||
var options = { | ||
clipboardSize: 0, | ||
beforeCopy: null, | ||
afterCopy: null, | ||
beforePaste: null, | ||
afterPaste: null | ||
}; | ||
$.extend(true, options, opts); | ||
function getScratch() { | ||
@@ -63,3 +52,3 @@ if (!cy.scratch("_clipboard")) { | ||
function changeIds(jsons) { | ||
jsons = $.extend(true, [], jsons); | ||
jsons = [].concat(jsons); | ||
for (var i = 0; i < jsons.length; i++) { | ||
@@ -105,9 +94,3 @@ var jsonFirst = jsons[i]; | ||
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; | ||
@@ -118,5 +101,2 @@ }, | ||
var res = cy.collection(); | ||
if(options.beforePaste) { | ||
options.beforePaste(clipboard[id]); | ||
} | ||
if (clipboard[id]) { | ||
@@ -132,5 +112,2 @@ var nodes = changeIds(clipboard[id].nodes); | ||
} | ||
if(options.afterPaste) { | ||
options.afterPaste(res); | ||
} | ||
return res; | ||
@@ -165,6 +142,6 @@ } | ||
if (typeof cytoscape !== 'undefined' && typeof jQuery !== 'undefined') { // expose to global cytoscape (i.e. window.cytoscape) | ||
register(cytoscape, jQuery); | ||
if (typeof cytoscape !== 'undefined') { // expose to global cytoscape (i.e. window.cytoscape) | ||
register(cytoscape); | ||
} | ||
})(); |
@@ -20,3 +20,3 @@ var gulp = require('gulp'); | ||
gulp.task('publish', [], function( next ){ | ||
runSequence('confver', 'lint', 'pkgver','push', 'tag', 'npm', next); | ||
runSequence('confver', /*'lint',*/ 'pkgver','push', 'tag', 'npm', next); | ||
}); | ||
@@ -23,0 +23,0 @@ |
{ | ||
"name": "cytoscape-clipboard", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"description": "Adds copy-paste utilities to cytoscape.", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-clipboard.js", |
@@ -9,6 +9,2 @@ cytoscape-clipboard | ||
## Demo | ||
Click [here](https://rawgit.com/iVis-at-Bilkent/cytoscape.js-clipboard/master/demo.html) for demo | ||
## API | ||
@@ -37,22 +33,3 @@ | ||
var options = { | ||
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) {} | ||
clipboardSize: 0 | ||
}; | ||
@@ -59,0 +36,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
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
79941
1808
88
4
4