mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-10 17:49:40 +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 { MermaidConfig } from './config.type';
|
||||||
import { evaluate } from './diagrams/common/common';
|
import { evaluate } from './diagrams/common/common';
|
||||||
|
|
||||||
|
const CLASSDEF_DIAGRAMS = ['graph', 'flowchart', 'flowchart-v2', 'stateDiagram'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param text
|
* @param text
|
||||||
* @param parseError
|
* @param parseError
|
||||||
@@ -255,8 +257,8 @@ const render = async function (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// classDef
|
// classDef
|
||||||
if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
|
if (CLASSDEF_DIAGRAMS.includes(graphType)) {
|
||||||
const classes: any = flowRenderer.getClasses(text, diag);
|
const classes: any = diag.renderer.getClasses(text, diag);
|
||||||
const htmlLabels = cnf.htmlLabels || cnf.flowchart?.htmlLabels;
|
const htmlLabels = cnf.htmlLabels || cnf.flowchart?.htmlLabels;
|
||||||
for (const className in classes) {
|
for (const className in classes) {
|
||||||
if (htmlLabels) {
|
if (htmlLabels) {
|
||||||
|
Reference in New Issue
Block a user