mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 00:09:51 +02:00
fix:prioritize flowchart.htmlLabels over global htmlLabels
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -1231,15 +1231,18 @@ class link myClass
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not create foreignObject elements when htmlLabels disabled via global config', () => {
|
it('should not render with htmlLabels when disabled via flowchart config, even when enabled in global config', () => {
|
||||||
renderGraph(
|
imgSnapshotTest(
|
||||||
`flowchart TD
|
`flowchart LR
|
||||||
A["Node with <br> HTML"] -- "edge <br> label" --> B["Another node"]
|
A["HTML label <br> with breaks"] --> B["Another label"]
|
||||||
C --> D
|
C --> D
|
||||||
`,
|
`,
|
||||||
{ htmlLabels: false }
|
{ htmlLabels: true, flowchart: { htmlLabels: false } },
|
||||||
|
undefined,
|
||||||
|
($svg) => {
|
||||||
|
expect($svg.find('foreignObject').length).to.equal(0);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
cy.get('svg foreignObject').should('not.exist');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create foreignObject elements when htmlLabels enabled', () => {
|
it('should create foreignObject elements when htmlLabels enabled', () => {
|
||||||
|
@@ -21,7 +21,7 @@ export const diagram = {
|
|||||||
if (cnf.layout) {
|
if (cnf.layout) {
|
||||||
setConfig({ layout: cnf.layout });
|
setConfig({ layout: cnf.layout });
|
||||||
}
|
}
|
||||||
cnf.flowchart.htmlLabels = cnf?.htmlLabels ?? cnf.flowchart?.htmlLabels;
|
cnf.flowchart.htmlLabels = cnf.flowchart?.htmlLabels ?? cnf?.htmlLabels;
|
||||||
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
setConfig({
|
setConfig({
|
||||||
flowchart: {
|
flowchart: {
|
||||||
|
@@ -13,7 +13,7 @@ export const labelHelper = async <T extends SVGGraphicsElement>(
|
|||||||
_classes?: string
|
_classes?: string
|
||||||
) => {
|
) => {
|
||||||
let cssClasses;
|
let cssClasses;
|
||||||
const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig()?.htmlLabels);
|
const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig()?.flowchart?.htmlLabels);
|
||||||
if (!_classes) {
|
if (!_classes) {
|
||||||
cssClasses = 'node default';
|
cssClasses = 'node default';
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user