mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
format
This commit is contained in:
@@ -257,27 +257,24 @@ const setClickFun = function(id, functionName, functionArgs) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let argList = [];
|
let argList = [];
|
||||||
if (typeof functionArgs === 'string') {
|
if (typeof functionArgs === 'string') {
|
||||||
/* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
/* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
||||||
argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
|
||||||
for (let i = 0; i < argList.length; i++) {
|
for (let i = 0; i < argList.length; i++) {
|
||||||
let item = argList[i].trim();
|
let item = argList[i].trim();
|
||||||
/* Removes all double quotes at the start and end of an argument */
|
/* Removes all double quotes at the start and end of an argument */
|
||||||
/* This preserves all starting and ending whitespace inside */
|
/* This preserves all starting and ending whitespace inside */
|
||||||
if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
|
||||||
item = item.substr(1, item.length - 2);
|
item = item.substr(1, item.length - 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
argList[i] = item;
|
|
||||||
}
|
}
|
||||||
|
argList[i] = item;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if no arguments passed into callback, default to passing in id */
|
/* if no arguments passed into callback, default to passing in id */
|
||||||
if (argList.length === 0) {
|
if (argList.length === 0) {
|
||||||
argList.push(id);
|
argList.push(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof vertices[id] !== 'undefined') {
|
if (typeof vertices[id] !== 'undefined') {
|
||||||
vertices[id].haveCallback = true;
|
vertices[id].haveCallback = true;
|
||||||
@@ -724,6 +721,7 @@ export default {
|
|||||||
addClass,
|
addClass,
|
||||||
setDirection,
|
setDirection,
|
||||||
setClass,
|
setClass,
|
||||||
|
setTooltip,
|
||||||
getTooltip,
|
getTooltip,
|
||||||
setClickEvent,
|
setClickEvent,
|
||||||
setLink,
|
setLink,
|
||||||
|
Reference in New Issue
Block a user