mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-01 05:09:34 +02:00
API: getClasses() with the diagram renderer (not flowchart renderer); add const
This commit is contained in:

parent
9660b0e9fb
commit
56f3fa6495
@@ -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) {
|
||||
|
Reference in New Issue
Block a user