Repository navigation
Replies: 2 comments
|
I also try to use useState to set/get the clicked element: ` const [targetType, setTargetType] = useState(""); const handleContextMenu = (event: any) => { I can see the event includes both event.targetType and event.target.id in the console. However, I can set the targetType value, but CANNOT set the target value. I also tried to set event.target itself, but I could not do it either. It looks like the event.target is not accessible from the setState. Any idea will be appreciated! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi there,
I'm testing the V5 beta contextmenu plugin and I have a question about the event handler.
In the previous version, handleMenuClick received two parameters: target and item. This provided clear information about the clicked menu item and the corresponding node, edge, or canvas element.
However, in the new V5 plugin API, the onClick function only receives two parameters: v (string) and target (HTMLElement). The target seems to be the clicked menu item itself, not the node, edge, or canvas that was right-clicked. Is this the intended behavior? I would expect the target to be the element that was right-clicked (node, edge, or canvas).
Additional Question:
Is there a way to enable right-click selection of nodes and edges in addition to left-click selection?
Thanks for your clarification!
-ZJ
All reactions