#2425 Unicode handling for HTML labels

This commit is contained in:
Ashish Jain
2021-10-21 19:37:48 +02:00
parent d144128bf0
commit 24d18eb42a
2 changed files with 19 additions and 22 deletions

View File

@@ -1,7 +1,8 @@
import createLabel from '../createLabel';
import { getConfig } from '../../config';
import { decodeEntities } from '../../mermaidAPI';
import { select } from 'd3';
import { evaluate } from '../../diagrams/common/common';
import { evaluate, sanitizeText } from '../../diagrams/common/common';
export const labelHelper = (parent, node, _classes, isNode) => {
let classes;
if (!_classes) {
@@ -20,7 +21,14 @@ export const labelHelper = (parent, node, _classes, isNode) => {
const text = label
.node()
.appendChild(createLabel(node.labelText, node.labelStyle, false, isNode));
.appendChild(
createLabel(
sanitizeText(decodeEntities(node.labelText), getConfig()),
node.labelStyle,
false,
isNode
)
);
// Get the size of the label
let bbox = text.getBBox();