mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 00:40:22 +02:00
Fix CSS cannot select number ID issue
This commit is contained in:
@@ -166,7 +166,7 @@ const setClickFun = function (id, functionName) {
|
||||
}
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
funs.push(function (element) {
|
||||
const elem = d3.select(element).select('#' + id)
|
||||
const elem = d3.select(element).select(`[id="${id}"]`)
|
||||
if (elem !== null) {
|
||||
elem.on('click', function () {
|
||||
window[functionName](id)
|
||||
@@ -182,7 +182,7 @@ const setLink = function (id, linkStr) {
|
||||
}
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
funs.push(function (element) {
|
||||
const elem = d3.select(element).select('#' + id)
|
||||
const elem = d3.select(element).select(`[id="${id}"]`)
|
||||
if (elem !== null) {
|
||||
elem.on('click', function () {
|
||||
window.open(linkStr, 'newTab')
|
||||
|
@@ -391,7 +391,7 @@ export const draw = function (text, id) {
|
||||
}
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
const svg = d3.select('#' + id)
|
||||
const svg = d3.select(`[id="${id}"]`)
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
const element = d3.select('#' + id + ' g')
|
||||
|
Reference in New Issue
Block a user