File tree Expand file tree Collapse file tree 4 files changed +250
-107
lines changed Expand file tree Collapse file tree 4 files changed +250
-107
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,59 @@ export const STATE_DIAGRAM_TESTCASES = [
174
174
}
175
175
` ,
176
176
} ,
177
+
178
+ {
179
+ name : "Notes" ,
180
+ definition : `stateDiagram-v2
181
+ State1: The state with a note
182
+ note right of State1
183
+ Important information! You can write
184
+ notes.
185
+ end note
186
+ State1 --> State2
187
+ note left of State2 : This is the note to the left.
188
+ ` ,
189
+ } ,
190
+ {
191
+ name : "Note left and right in same state" ,
192
+ definition : `stateDiagram-v2
193
+ State1: The state with a note
194
+ note right of State1
195
+ Important information! You can write
196
+ notes.
197
+ end note
198
+ note left of State1 : This is the note to the left.
199
+ ` ,
200
+ } ,
201
+ {
202
+ name : "Multiple notes in the same state" ,
203
+ definition : `stateDiagram-v2
204
+ State1: The state with a note
205
+ note right of State1
206
+ Important information! You can write
207
+ notes.
208
+ end note
209
+ note left of State1 : Left.
210
+ note left of State1 : Join.
211
+ note left of State1 : Out.
212
+ note right of State1 : Ok!.
213
+ ` ,
214
+ } ,
215
+ {
216
+ name : "Notes inside a composite state" ,
217
+ definition : `stateDiagram-v2
218
+ [*] --> First
219
+ state First {
220
+ [*] --> second
221
+ second --> [*]
222
+
223
+ note right of second
224
+ First is a composite state
225
+ end note
226
+
227
+ }
228
+ ` ,
229
+ } ,
177
230
{
178
231
name : "Sample 1" ,
179
232
definition : `stateDiagram-v2
Original file line number Diff line number Diff line change @@ -23,9 +23,11 @@ export const StateToExcalidrawSkeletonConvertor = new GraphConverter({
23
23
case "rectangle" :
24
24
const element = transformToExcalidrawContainerSkeleton ( node ) ;
25
25
26
- Object . assign ( element , {
27
- roundness : { type : 3 } ,
28
- } ) ;
26
+ if ( ! element . id ?. includes ( "note" ) ) {
27
+ Object . assign ( element , {
28
+ roundness : { type : 3 } ,
29
+ } ) ;
30
+ }
29
31
30
32
elements . push ( element ) ;
31
33
break ;
@@ -43,6 +45,10 @@ export const StateToExcalidrawSkeletonConvertor = new GraphConverter({
43
45
} ) ;
44
46
45
47
chart . edges . forEach ( ( edge ) => {
48
+ if ( ! edge ) {
49
+ return ;
50
+ }
51
+
46
52
const points = edge . reflectionPoints . map ( ( point : Point ) => [
47
53
point . x - edge . reflectionPoints [ 0 ] . x ,
48
54
point . y - edge . reflectionPoints [ 0 ] . y ,
@@ -61,6 +67,11 @@ export const StateToExcalidrawSkeletonConvertor = new GraphConverter({
61
67
return ;
62
68
}
63
69
70
+ if ( endVertex . id ?. includes ( "note" ) || startVertex . id ?. includes ( "note" ) ) {
71
+ arrow . endArrowhead = null ;
72
+ arrow . strokeStyle = "dashed" ;
73
+ }
74
+
64
75
arrow . start = {
65
76
id : startVertex . id ,
66
77
type : "rectangle" ,
You can’t perform that action at this time.
0 commit comments