mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-09 22:14:10 +01:00
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:
@@ -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 = `<<${relation.type}>>`;
|
||||
if (!config.htmlLabels) {
|
||||
relationLabel = relationLabel.replace(/</g, '<').replace(/>/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: `<<${relation.type}>>`,
|
||||
label: relationLabel,
|
||||
classes: 'relationshipLine',
|
||||
style: ['fill:none', isContains ? '' : 'stroke-dasharray: 10,7'],
|
||||
labelpos: 'c',
|
||||
|
||||
@@ -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('>', '>').replaceAll('<', '<');
|
||||
}
|
||||
// if (useHtmlLabels === false) {
|
||||
// edge.label = edge.label.replaceAll('>', '>').replaceAll('<', '<');
|
||||
// }
|
||||
const labelElement = await createText(elem, edge.label, {
|
||||
style: edge.labelStyle,
|
||||
useHtmlLabels,
|
||||
|
||||
Reference in New Issue
Block a user