Name: cytoscape.js-clipboard
Owner: iVis-at-Bilkent
Description: A Cytoscape.js extension to provide copy-paste utilities
Created: 2016-06-28 11:02:16.0
Updated: 2017-09-22 06:30:52.0
Pushed: 2017-12-19 11:59:06.0
Size: 53
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A Cytoscape.js extension to provide copy-paste utilities, distributed under The MIT License.
Click here for demo
var cy = cytoscape({...});
var cb = cy.clipboard(options);
cy.clipboard(options)
Initializes extension & sets options.
cb.copy(eles [, id])
Copies eles and returns id of operation. If id
is not specified, it will be assigned automatically.
cb.paste([id])
Pastes the copied elements which has id
. If id
is not specified, it will have the last operation's id.
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) {}
};
ur.do("paste"[, { id: idOfOperation }])
Pastes operation. id is optional as is in cb.paste()
Download the library:
npm install cytoscape-clipboard
,bower install cytoscape-clipboard
, orrequire()
the library as appropriate for your project:
CommonJS:
cytoscape = require('cytoscape');
jquery = require('jquery');
clipboard = require('cytoscape-clipboard');
board( cytoscape, jquery ); // register extension
AMD:
ire(['cytoscape', 'cytoscape-clipboard'], function( cytoscape, clipboard ){
ipboard( cytoscape ); // register extension
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
This project is set up to automatically be published to npm and bower. To publish:
export VERSION=1.2.3
gulp publish
bower register cytoscape-clipboard https://github.com/iVis-at-Bilkent/clipboard.git