cytoscape-clipboard
Description
A Cytoscape.js extension to provide copy-paste utilities, distributed under The MIT License.
Demo
Click here for demo
API
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.
Default Options
var options = {
beforeCopy: function(eles) {},
afterCopy: function(clipboard) {},
beforePaste: function(clipboard) {},
afterPaste: function(eles) {}
};
Default Undo Redo Actions
ur.do("paste"[, { id: idOfOperation }])
Pastes operation. id is optional as is in cb.paste()
Dependencies
- Cytoscape.js ^2.6.12 || ^3.0.0
- jQuery ^1.3.2 || ^2.0.0 || ^3.0.0
- cytoscape-undo-redo ^1.0.8 (optional)
Usage instructions
Download the library:
- via npm:
npm install cytoscape-clipboard
, - via bower:
bower install cytoscape-clipboard
, or - via direct download in the repository (probably from a tag).
require()
the library as appropriate for your project:
CommonJS:
var cytoscape = require('cytoscape');
var jquery = require('jquery');
var clipboard = require('cytoscape-clipboard');
clipboard( cytoscape, jquery );
AMD:
require(['cytoscape', 'cytoscape-clipboard'], function( cytoscape, clipboard ){
clipboard( cytoscape );
});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
Publishing instructions
This project is set up to automatically be published to npm and bower. To publish:
- Set the version number environment variable:
export VERSION=1.2.3
- Publish:
gulp publish
- If publishing to bower for the first time, you'll need to run
bower register cytoscape-clipboard https://github.com/iVis-at-Bilkent/clipboard.git
Team