fix: prevent escaping label styles

This commit is contained in:
Yash Singh 2024-06-24 16:07:43 -07:00
parent ce3b0af03a
commit ab726f008c
2 changed files with 8 additions and 16 deletions

View File

@ -25,15 +25,10 @@ function addHtmlLabel(node) {
const label = node.label;
const labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
div.html(
'<span class="' +
labelClass +
'" ' +
(node.labelStyle ? 'style="' + node.labelStyle + '"' : '') +
'>' +
label +
'</span>'
);
const span = div.append('span');
span.html(label);
applyStyle(span, node.labelStyle);
span.attr('class', labelClass);
applyStyle(div, node.labelStyle);
div.style('display', 'inline-block');

View File

@ -21,13 +21,10 @@ function addHtmlSpan(element, node, width, classes, addBackground = false) {
const label = node.label;
const labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
div.html(
`<span class="${labelClass} ${classes}" ` +
(node.labelStyle ? 'style="' + node.labelStyle + '"' : '') +
'>' +
label +
'</span>'
);
const span = div.append('span');
span.html(label);
applyStyle(span, node.labelStyle);
span.attr('class', `${labelClass} ${classes}`);
applyStyle(div, node.labelStyle);
div.style('display', 'table-cell');