File tree 2 files changed +17
-8
lines changed
2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,15 @@ export default function Page() {
84
84
const targetNode = nodes . find ( ( node ) => node . id === params . target ) ;
85
85
86
86
if (
87
- sourceNode ?. type === "LabeledGroupNode" &&
88
- targetNode ?. type === "LabeledGroupNode"
87
+ sourceNode ?. type === "CustomChildNode" &&
88
+ ( targetNode ?. type === "LabeledGroupNode" ||
89
+ targetNode . extent !== "parent" )
89
90
) {
91
+ toast . error ( "Invalid Connection" ) ;
92
+ return ;
93
+ }
94
+
95
+ if ( sourceNode ?. type === "LabeledGroupNode" ) {
90
96
const newEdge = {
91
97
...params ,
92
98
type : "CustomEdge" ,
Original file line number Diff line number Diff line change @@ -60,15 +60,14 @@ const CustomEdge = ({
60
60
} ;
61
61
62
62
return (
63
- < >
63
+ < g onDoubleClick = { openModal } >
64
64
< BaseEdge
65
65
id = { id }
66
66
path = { edgePath }
67
67
{ ...props }
68
68
interactionWidth = { 20 }
69
- onDoubleClick = { openModal }
70
69
/>
71
- < EdgeLabelRenderer >
70
+ < EdgeLabelRenderer onDoubleClick = { openModal } >
72
71
< div
73
72
style = { {
74
73
position : "absolute" ,
@@ -77,8 +76,9 @@ const CustomEdge = ({
77
76
paddingBlock : 4 ,
78
77
borderRadius : 2 ,
79
78
fontSize : 10 ,
79
+ pointerEvents : "all" ,
80
80
} }
81
- className = "nodrag nopan items-left flex flex-col gap-1 border border-yellow-700 bg-[#ffcc00] font-semibold text-black"
81
+ className = "nodrag nopan items-left flex cursor-pointer flex-col gap-1 border border-yellow-700 bg-[#ffcc00] font-semibold text-black"
82
82
>
83
83
< div className = "flex items-center gap-1" >
84
84
< SquarePlus size = { 10 } />
@@ -87,7 +87,10 @@ const CustomEdge = ({
87
87
{ data . result && ( // Only show result if it's not empty
88
88
< div className = "flex items-center gap-1" >
89
89
< Flag size = { 10 } />
90
- Result: { data . result }
90
+ Result:{ " " }
91
+ < span className = "max-w-44 truncate text-yellow-900" >
92
+ { data . result }
93
+ </ span >
91
94
</ div >
92
95
) }
93
96
</ div >
@@ -127,7 +130,7 @@ const CustomEdge = ({
127
130
</ DialogContent >
128
131
</ Dialog >
129
132
) }
130
- </ >
133
+ </ g >
131
134
) ;
132
135
} ;
133
136
You can’t perform that action at this time.
0 commit comments