mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-04 11:34:23 +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
|
||||
if (classDefs && Object.keys(classDefs).length > 0) {
|
||||
if (!isEmpty(classDefs)) {
|
||||
if (CLASSDEF_DIAGRAMS.includes(graphType)) {
|
||||
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
|
||||
const svg = element.firstChild;
|
||||
const firstChild = svg.firstChild;
|
||||
const diagramClassDefs = CLASSDEF_DIAGRAMS.includes(graphType)
|
||||
? diag.renderer.getClasses(text, diag)
|
||||
: {};
|
||||
|
||||
const rules = createUserStyles(
|
||||
config,
|
||||
graphType,
|
||||
// @ts-ignore convert renderer to TS.
|
||||
diag.renderer.getClasses(text, diag),
|
||||
diagramClassDefs,
|
||||
idSelector
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user