-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: supports link on connections #1955
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what adding an empty <a>
tag does. There's nothing for users to click and no indication it's clickable.
I was imagining something like this: link
on the connection makes the label a hyperlink. So google
here would be underlined and be in link-style blue (or purple if clicked). If there's a link and no label, the link becomes the label.
Oh I see what you mean. I was trying to figure out how exactly you wanted it implemented so I decided to do this for now and get a review. I'll work on it |
Was this more what you were thinking? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup!
d2graph/d2graph.go
Outdated
if edge.Link != nil { | ||
g.Edges[i].Label.Value = edge.Link.Value | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't be in this function named set dimensions. probably in compiler.go.
Also the link shouldn't replace the label if there is one. The test should show an example of where the link turns the label into a hyperlink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh also i think it's a security issue if the edge label is a URL and the edge link is a URL and they are not the same URL. can you make that a compiler error and add a test for it please? (i'm pretty sure we do this for tooltips and links or something already)
Hi, what's the status on this PR? |
Oops I did not realize the ball was in my court for reviewing. Sorry @danielsuh05 . I'm not sure if you've moved on. No worries if so I can take over, otherwise will leave a review ASAP |
I hope to see this soon. Links on connections are pretty important. They open up a lot of possibilities for letting diagrams act as jump points to, e.g., code. |
I'm ok continuing with this issue. |
Thank you @danielsuh05 and @alixander! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you squash all the implementation commits into one and the test diffs into another? makes it easier to review to just see the diff for the implementation
the conflicts should just be a test rerun after rebasing master
446eb96
to
ce752d4
Compare
ce752d4
to
92ea220
Compare
}, | ||
{ | ||
name: "url_link_and_path_url_label_ok", | ||
text: `x -> y note: {link: https://not-google.com}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the colon is not in the right place, should be x -> y: note {...}
}, | ||
{ | ||
name: "url_link_and_path_url_label_concurrently", | ||
text: `x -> y: hello world {link: https://google.com}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same test as above?
|
||
fmt.Fprintf(writer, `<a href="%s" xlink:href="%[1]s">`, svg.EscapeText(connection.Link)) | ||
} else { | ||
textEl.Fill = connection.GetFontColor() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is fill dependent?
Connections now support
link:
(fixes issue #1827)Some notes:
link: ""
.link-on-connections
for the test I used.