mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-10 02:49:40 +02:00
Render nodes as real links
This commit is contained in:
@@ -70,6 +70,9 @@ export const addVertices = function (vert, g) {
|
||||
verticeText = verticeText.replace(/fa:fa[\w-]+/g, function (s) {
|
||||
return '<i class="fa ' + s.substring(3) + '"></i>'
|
||||
})
|
||||
if (vertice.link) {
|
||||
verticeText = '<a href="' + vertice.link + '" rel="noopener">' + verticeText + '</a>'
|
||||
}
|
||||
} else {
|
||||
const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text')
|
||||
|
||||
@@ -85,7 +88,14 @@ export const addVertices = function (vert, g) {
|
||||
}
|
||||
|
||||
labelTypeStr = 'svg'
|
||||
verticeText = svgLabel
|
||||
if (vertice.link) {
|
||||
const link = document.createElementNS('http://www.w3.org/2000/svg', 'a')
|
||||
link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertice.link)
|
||||
link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener')
|
||||
verticeText = link
|
||||
} else {
|
||||
verticeText = svgLabel
|
||||
}
|
||||
}
|
||||
|
||||
let radious = 0
|
||||
|
Reference in New Issue
Block a user