mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-05 20:14:14 +01:00
only call getClasses if the diagram renderer supports it
This commit is contained in:
parent
46ee4e426f
commit
6d2441dff6
@@ -180,7 +180,7 @@ export const createCssStyles = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// classDefs defined in the diagram text
|
// classDefs defined in the diagram text
|
||||||
if (classDefs && Object.keys(classDefs).length > 0) {
|
if (!isEmpty(classDefs)) {
|
||||||
if (CLASSDEF_DIAGRAMS.includes(graphType)) {
|
if (CLASSDEF_DIAGRAMS.includes(graphType)) {
|
||||||
const htmlLabels = config.htmlLabels || config.flowchart?.htmlLabels; // TODO why specifically check the Flowchart diagram config?
|
const htmlLabels = config.htmlLabels || config.flowchart?.htmlLabels; // TODO why specifically check the Flowchart diagram config?
|
||||||
|
|
||||||
@@ -481,11 +481,15 @@ const render = async function (
|
|||||||
// Insert an element into svg. This is where we put the styles
|
// Insert an element into svg. This is where we put the styles
|
||||||
const svg = element.firstChild;
|
const svg = element.firstChild;
|
||||||
const firstChild = svg.firstChild;
|
const firstChild = svg.firstChild;
|
||||||
|
const diagramClassDefs = CLASSDEF_DIAGRAMS.includes(graphType)
|
||||||
|
? diag.renderer.getClasses(text, diag)
|
||||||
|
: {};
|
||||||
|
|
||||||
const rules = createUserStyles(
|
const rules = createUserStyles(
|
||||||
config,
|
config,
|
||||||
graphType,
|
graphType,
|
||||||
// @ts-ignore convert renderer to TS.
|
// @ts-ignore convert renderer to TS.
|
||||||
diag.renderer.getClasses(text, diag),
|
diagramClassDefs,
|
||||||
idSelector
|
idSelector
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user