API: getClasses() with the diagram renderer (not flowchart renderer); add const

This commit is contained in:
Ashley Engelund (weedySeaDragon @ github)
2022-10-10 18:02:20 -07:00
parent 9660b0e9fb
commit 56f3fa6495

View File

@@ -33,6 +33,8 @@ import DOMPurify from 'dompurify';
import { MermaidConfig } from './config.type';
import { evaluate } from './diagrams/common/common';
const CLASSDEF_DIAGRAMS = ['graph', 'flowchart', 'flowchart-v2', 'stateDiagram'];
/**
* @param text
* @param parseError
@@ -255,8 +257,8 @@ const render = async function (
}
// classDef
if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
const classes: any = flowRenderer.getClasses(text, diag);
if (CLASSDEF_DIAGRAMS.includes(graphType)) {
const classes: any = diag.renderer.getClasses(text, diag);
const htmlLabels = cnf.htmlLabels || cnf.flowchart?.htmlLabels;
for (const className in classes) {
if (htmlLabels) {