-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding support for context-menu #196
Conversation
@cleaaum this looks great! Two questions about the API:
|
@alexcjohnson Thank you for the review Alex! I've addressed all comments except for the add-edge one (i've left an explanation). I think I prefer differentiating them with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 🚀 🚀
Looks good to me!!!
I notice there is still one failing CI step (let me know if you want another pair of eyes on that) but in my eyes this is essentially ready. Great work @cleaaum 💪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 Looks great!
This PR integrates the external js library "cytoscape-context-menus" to give the user the ability to define its own context menu.
In order to add a context menu item the user needs to use the
contextMenu
prop and pass at least the following items to create the menu item.Then, the user has three options to define the
onClick
behaviour:remove
,add_node
, andadd_edge
are supported. This is done by setting"onClick": "remove"
for example.window.dashCytoscapeComponentFunctions
. This is done by setting"onClickCustom": "add-2-nodes"
for example, whereadd-2-nodes
is defined in the namespace.ContextMenuData
andelements
prop. The user must simply omit the"onClick"
key.I've provided a sample app (usage-context-menu.py) with a context menu and also provided a js namespace under assets/ctxMenuFns.js with an example of a user defined js function.
This example has the following context menu items implemented via the following methods:
remove
,add_node
, andadd_edge
.add-2-nodes
split_edge
andrevert_edge
Pre-Merge checklist
npm run build:all
.