mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-15 13:29:40 +02:00
#922 Fix for click binding on nodes with ids starting with a number
This commit is contained in:
@@ -13,6 +13,12 @@
|
|||||||
click Function clickByFlow "Add a div"
|
click Function clickByFlow "Add a div"
|
||||||
click URL "https://mermaidjs.github.io/" "Visit <strong>mermaid docs</strong>"
|
click URL "https://mermaidjs.github.io/" "Visit <strong>mermaid docs</strong>"
|
||||||
</div>
|
</div>
|
||||||
|
<div id="FirstLine" class="mermaid">
|
||||||
|
graph TB
|
||||||
|
1Function-->2URL
|
||||||
|
click 1Function clickByFlow "Add a div"
|
||||||
|
click 2URL "https://mermaidjs.github.io/" "Visit <strong>mermaid docs</strong>"
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mermaid">
|
<div class="mermaid">
|
||||||
gantt
|
gantt
|
||||||
|
@@ -200,7 +200,9 @@ const setTooltip = function (ids, tooltip) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const setClickFun = function (id, functionName) {
|
const setClickFun = function (_id, functionName) {
|
||||||
|
let id = _id
|
||||||
|
if (_id[0].match(/\d/)) id = 's' + id
|
||||||
if (config.securityLevel !== 'loose') {
|
if (config.securityLevel !== 'loose') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -226,7 +228,9 @@ const setClickFun = function (id, functionName) {
|
|||||||
* @param tooltip Tooltip for the clickable element
|
* @param tooltip Tooltip for the clickable element
|
||||||
*/
|
*/
|
||||||
export const setLink = function (ids, linkStr, tooltip) {
|
export const setLink = function (ids, linkStr, tooltip) {
|
||||||
ids.split(',').forEach(function (id) {
|
ids.split(',').forEach(function (_id) {
|
||||||
|
let id = _id
|
||||||
|
if (_id[0].match(/\d/)) id = 's' + id
|
||||||
if (typeof vertices[id] !== 'undefined') {
|
if (typeof vertices[id] !== 'undefined') {
|
||||||
if (config.securityLevel !== 'loose') {
|
if (config.securityLevel !== 'loose') {
|
||||||
vertices[id].link = sanitizeUrl(linkStr) // .replace(/javascript:.*/g, '')
|
vertices[id].link = sanitizeUrl(linkStr) // .replace(/javascript:.*/g, '')
|
||||||
|
Reference in New Issue
Block a user