Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
cytoscape-context-menus
Advanced tools
A Cytoscape.js extension to provide context menu around elements and core instance.
A Cytoscape.js extension to provide context menu around elements and core instance.
Download the library:
npm install cytoscape-context-menus
,bower install cytoscape-context-menus
, orrequire()
the library as appropriate for your project:
CommonJS:
var cytoscape = require('cytoscape');
var context-menus = require('cytoscape-context-menus');
context-menus( cytoscape ); // register extension
AMD:
require(['cytoscape', 'cytoscape-context-menus'], function( cytoscape, context-menus ){
context-menus( cytoscape ); // register extension
});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
var options = {
// List of initial menu items
menuItems: [/*
{
id: 'remove', // ID of menu item
title: 'remove', // Title of menu item
selector: 'node, edge', // Filters the elements to have this menu item on cxttap
onClickFunction: function () { // The function to be executed on click
console.log('remove element');
},
disabled: false, // Whether the item will be created as disabled
hasTrailingDivider: true, // Whether the item will have a trailing divider
coreAsWell: false // Whether core instance have this item on cxttap
},
{
id: 'hide',
title: 'hide',
selector: 'node, edge',
onClickFunction: function () {
console.log('hide element');
},
disabled: true
},
{
id: 'add-node',
title: 'add node',
selector: 'node',
coreAsWell: true,
onClickFunction: function () {
console.log('add node');
}
}*/
],
// css classes that menu items will have
menuItemClasses: [
// add class names to this list
],
// css classes that context menu will have
contextMenuClasses: [
// add class names to this list
]
};
cy.contextMenus(options)
To initialize with options.
cy.appendMenuItem(item)
Appends given menu item to the menu items list.
cy.appendMenuItems(items)
Appends menu items in the given list to the menu items list.
cy.removeMenuItem(itemID)
Removes the menu item with given ID.
cy.setTrailingDivider(itemID, status)
Sets whether the menuItem with given ID will have a following divider.
cy.insertBeforeMenuItem(item, existingItemID)
Inserts given item before the existingitem.
cy.moveBeforeOtherMenuItem(itemID, existingItemID)
Moves the item with given ID before the existingitem.
cy.disableMenuItem(itemID)
Disables the menu item with given ID.
cy.enableMenuItem(itemID)
Enables the menu item with given ID.
cy.destroyContextMenus()
Destroys the extension instance
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-context-menus https://github.com/iVis-at-Bilkent/cytoscape.js-context-menus.git
FAQs
A Cytoscape.js extension to provide context menu around elements and core instance.
The npm package cytoscape-context-menus receives a total of 10,804 weekly downloads. As such, cytoscape-context-menus popularity was classified as popular.
We found that cytoscape-context-menus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.