This commit is contained in:
Alexander Wang 2023-02-20 14:18:55 -08:00
parent aff6723d38
commit f7a5689280
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
4 changed files with 19 additions and 9 deletions

View file

@ -1364,8 +1364,8 @@ x -> y: {
if len(g.Objects) != 1 { if len(g.Objects) != 1 {
t.Fatal(g.Objects) t.Fatal(g.Objects)
} }
if g.Objects[0].Attributes.Link != "https://google.com" { if g.Objects[0].Attributes.Link.Value != "https://google.com" {
t.Fatal(g.Objects[0].Attributes.Link) t.Fatal(g.Objects[0].Attributes.Link.Value)
} }
}, },
}, },
@ -1380,8 +1380,8 @@ x -> y: {
if len(g.Objects) != 1 { if len(g.Objects) != 1 {
t.Fatal(g.Objects) t.Fatal(g.Objects)
} }
if g.Objects[0].Attributes.Link != "Overview.Untitled board 7.zzzzz" { if g.Objects[0].Attributes.Link.Value != "Overview.Untitled board 7.zzzzz" {
t.Fatal(g.Objects[0].Attributes.Link) t.Fatal(g.Objects[0].Attributes.Link.Value)
} }
}, },
}, },

View file

@ -152,8 +152,12 @@ func toShape(obj *d2graph.Object, theme *d2themes.Theme) d2target.Shape {
} }
} }
shape.Tooltip = obj.Attributes.Tooltip if obj.Attributes.Tooltip != nil {
shape.Link = obj.Attributes.Link shape.Tooltip = obj.Attributes.Tooltip.Value
}
if obj.Attributes.Link != nil {
shape.Link = obj.Attributes.Link.Value
}
shape.Icon = obj.Attributes.Icon shape.Icon = obj.Attributes.Icon
if obj.IconPosition != nil { if obj.IconPosition != nil {
shape.IconPosition = *obj.IconPosition shape.IconPosition = *obj.IconPosition
@ -232,7 +236,9 @@ func toConnection(edge *d2graph.Edge, theme *d2themes.Theme) d2target.Connection
connection.Animated, _ = strconv.ParseBool(edge.Attributes.Style.Animated.Value) connection.Animated, _ = strconv.ParseBool(edge.Attributes.Style.Animated.Value)
} }
connection.Tooltip = edge.Attributes.Tooltip if edge.Attributes.Tooltip != nil {
connection.Tooltip = edge.Attributes.Tooltip.Value
}
connection.Icon = edge.Attributes.Icon connection.Icon = edge.Attributes.Icon
if edge.Attributes.Style.Italic != nil { if edge.Attributes.Style.Italic != nil {

View file

@ -129,7 +129,9 @@
"value": "x" "value": "x"
}, },
"style": {}, "style": {},
"link": "Overview.Untitled board 7.zzzzz", "link": {
"value": "Overview.Untitled board 7.zzzzz"
},
"near_key": null, "near_key": null,
"shape": { "shape": {
"value": "rectangle" "value": "rectangle"

View file

@ -129,7 +129,9 @@
"value": "x" "value": "x"
}, },
"style": {}, "style": {},
"link": "https://google.com", "link": {
"value": "https://google.com"
},
"near_key": null, "near_key": null,
"shape": { "shape": {
"value": "rectangle" "value": "rectangle"