fix: context menu dismisses on pane click, ISP in toolbar

Context menu now closes when clicking anywhere on the canvas via
onPaneClick prop. ISP device added as built-in toolbar item under
Internet section so it's always available without a database entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-04-04 17:44:48 +00:00
parent 6e5614e7b4
commit 2ea56f2563
3 changed files with 31 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ interface NetworkCanvasProps {
isDragOver?: boolean
onNodeContextMenu?: (event: React.MouseEvent, node: Node) => void
onPaneContextMenu?: (event: MouseEvent | React.MouseEvent) => void
onPaneClick?: () => void
}
export function NetworkCanvas({
@@ -44,6 +45,7 @@ export function NetworkCanvas({
isDragOver,
onNodeContextMenu,
onPaneContextMenu,
onPaneClick: onPaneClickProp,
}: NetworkCanvasProps) {
const handleSelectionChange = useCallback(({ nodes: selectedNodes, edges: selectedEdges }: { nodes: Node[]; edges: Edge[] }) => {
if (selectedNodes.length === 1) {
@@ -61,7 +63,8 @@ export function NetworkCanvas({
const handlePaneClick = useCallback(() => {
onNodeSelect(null)
onEdgeSelect(null)
}, [onNodeSelect, onEdgeSelect])
onPaneClickProp?.()
}, [onNodeSelect, onEdgeSelect, onPaneClickProp])
return (
<div className="relative h-full w-full" onDragLeave={onDragLeave}>