fix: Move HTML entity decoding logic from generic insertEdgeLabel to requirement-specific getData method

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
darshanr0107
2025-09-16 13:56:12 +05:30
parent 5be5415eee
commit eb373ef207
2 changed files with 10 additions and 4 deletions

View File

@@ -317,11 +317,17 @@ export class RequirementDB implements DiagramDB {
for (const relation of this.relations) {
let counter = 0;
const isContains = relation.type === this.Relationships.CONTAINS;
let relationLabel = `&lt;&lt;${relation.type}&gt;&gt;`;
if (!config.htmlLabels) {
relationLabel = relationLabel.replace(/&lt;/g, '<').replace(/&gt;/g, '>');
}
const edge: Edge = {
id: `${relation.src}-${relation.dst}-${counter}`,
start: this.requirements.get(relation.src)?.name ?? this.elements.get(relation.src)?.name,
end: this.requirements.get(relation.dst)?.name ?? this.elements.get(relation.dst)?.name,
label: `&lt;&lt;${relation.type}&gt;&gt;`,
label: relationLabel,
classes: 'relationshipLine',
style: ['fill:none', isContains ? '' : 'stroke-dasharray: 10,7'],
labelpos: 'c',

View File

@@ -48,9 +48,9 @@ export const insertEdgeLabel = async (elem, edge) => {
const { labelStyles } = styles2String(edge);
edge.labelStyle = labelStyles;
if (useHtmlLabels === false) {
edge.label = edge.label.replaceAll('&gt;', '>').replaceAll('&lt;', '<');
}
// if (useHtmlLabels === false) {
// edge.label = edge.label.replaceAll('&gt;', '>').replaceAll('&lt;', '<');
// }
const labelElement = await createText(elem, edge.label, {
style: edge.labelStyle,
useHtmlLabels,