mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-02 15:16:49 +02:00
1169- break out getRows
Moved getRows function from `state/stateRenderer.js` and `state/shapes.js` into `common/common.js`. Broke out section into small one line functions for replacing line breaks, then moved the `sanitize` function from `utils.js` to this new module as there is shared functionality
This commit is contained in:
20
src/utils.js
20
src/utils.js
@@ -74,25 +74,6 @@ export const interpolateToCurve = (interpolate, defaultCurve) => {
|
||||
return d3[curveName] || defaultCurve;
|
||||
};
|
||||
|
||||
export const sanitize = (text, config) => {
|
||||
let txt = text;
|
||||
let htmlLabels = true;
|
||||
if (
|
||||
config.flowchart &&
|
||||
(config.flowchart.htmlLabels === false || config.flowchart.htmlLabels === 'false')
|
||||
)
|
||||
htmlLabels = false;
|
||||
|
||||
if (config.securityLevel !== 'loose' && htmlLabels) { // eslint-disable-line
|
||||
txt = txt.replace(/<br\s*\/?>/gi, '#br#');
|
||||
txt = txt.replace(/</g, '<').replace(/>/g, '>');
|
||||
txt = txt.replace(/=/g, '=');
|
||||
txt = txt.replace(/#br#/g, '<br/>');
|
||||
}
|
||||
|
||||
return txt;
|
||||
};
|
||||
|
||||
export const formatUrl = (linkStr, config) => {
|
||||
let url = linkStr.trim();
|
||||
|
||||
@@ -225,7 +206,6 @@ export default {
|
||||
interpolateToCurve,
|
||||
calcLabelPosition,
|
||||
calcCardinalityPosition,
|
||||
sanitize,
|
||||
formatUrl,
|
||||
getStylesFromArray
|
||||
};
|
||||
|
Reference in New Issue
Block a user