diff --git a/src/diagrams/flowchart/flowDb.js b/src/diagrams/flowchart/flowDb.js index 4985270916..630c412cbc 100644 --- a/src/diagrams/flowchart/flowDb.js +++ b/src/diagrams/flowchart/flowDb.js @@ -25,12 +25,14 @@ let version; // As in graph // Functions to be run after graph rendering let funs = []; +const sanitizeText = (txt) => common.sanitizeText(txt, config); + export const parseDirective = function (statement, context, type) { mermaidAPI.parseDirective(this, statement, context, type); }; const setTitle = function (txt) { - title = txt; + title = sanitizeText(txt); }; const getTitle = function () { @@ -38,7 +40,7 @@ const getTitle = function () { }; const setAccDescription = function (txt) { - description = txt; + description = sanitizeText(txt); }; const getAccDescription = function () { @@ -95,7 +97,7 @@ export const addVertex = function (_id, text, type, style, classes, dir, props = vertexCounter++; if (typeof text !== 'undefined') { config = configApi.getConfig(); - txt = common.sanitizeText(text.trim(), config); + txt = sanitizeText(text.trim()); // strip quotes if string starts and ends with a quote if (txt[0] === '"' && txt[txt.length - 1] === '"') { @@ -150,7 +152,7 @@ export const addSingleLink = function (_start, _end, type, linktext) { linktext = type.text; if (typeof linktext !== 'undefined') { - edge.text = common.sanitizeText(linktext.trim(), config); + edge.text = sanitizeText(linktext.trim()); // strip quotes if string starts and exnds with a quote if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') { @@ -273,7 +275,7 @@ export const setClass = function (ids, className) { const setTooltip = function (ids, tooltip) { ids.split(',').forEach(function (id) { if (typeof tooltip !== 'undefined') { - tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = common.sanitizeText(tooltip, config); + tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = sanitizeText(tooltip); } }); }; @@ -506,7 +508,7 @@ export const addSubGraph = function (_id, list, _title) { id = id || 'subGraph' + subCount; // if (id[0].match(/\d/)) id = lookUpDomId(id); title = title || ''; - title = common.sanitizeText(title, config); + title = sanitizeText(title); subCount = subCount + 1; const subGraph = { id: id, nodes: nodeList, title: title.trim(), classes: [], dir };