import { React, Icons } from '@esengine/editor-runtime'; const { Trash2, Replace, Plus } = Icons; interface NodeContextMenuProps { visible: boolean; position: { x: number; y: number }; nodeId: string | null; isBlackboardVariable?: boolean; onReplaceNode?: () => void; onDeleteNode?: () => void; onCreateNode?: () => void; } export const NodeContextMenu: React.FC = ({ visible, position, nodeId, isBlackboardVariable = false, onReplaceNode, onDeleteNode, onCreateNode }) => { if (!visible) return null; const menuItemStyle = { padding: '8px 16px', cursor: 'pointer', color: '#cccccc', fontSize: '13px', transition: 'background-color 0.15s', display: 'flex', alignItems: 'center', gap: '8px' }; return (
e.stopPropagation()} > {nodeId ? ( <> {onReplaceNode && (
e.currentTarget.style.backgroundColor = '#094771'} onMouseLeave={(e) => e.currentTarget.style.backgroundColor = 'transparent'} > 替换节点
)} {onDeleteNode && (
e.currentTarget.style.backgroundColor = '#5a1a1a'} onMouseLeave={(e) => e.currentTarget.style.backgroundColor = 'transparent'} > 删除节点
)} ) : ( <> {onCreateNode && (
e.currentTarget.style.backgroundColor = '#094771'} onMouseLeave={(e) => e.currentTarget.style.backgroundColor = 'transparent'} > 新建节点
)} )}
); };