mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Merge pull request #5786 from mermaid-js/5782_supporting_defaultRenderer
#5782 fix: adding backwards compatability for defaultRenderer directive
This commit is contained in:
commit
0bd00764c4
@ -7,13 +7,14 @@ import type {
|
||||
const id = 'flowchart-v2';
|
||||
|
||||
const detector: DiagramDetector = (txt, config) => {
|
||||
if (
|
||||
config?.flowchart?.defaultRenderer === 'dagre-d3' ||
|
||||
config?.flowchart?.defaultRenderer === 'elk'
|
||||
) {
|
||||
if (config?.flowchart?.defaultRenderer === 'dagre-d3') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (config?.flowchart?.defaultRenderer === 'elk') {
|
||||
config.layout = 'elk';
|
||||
}
|
||||
|
||||
// If we have configured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram
|
||||
if (/^\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === 'dagre-wrapper') {
|
||||
return true;
|
||||
|
@ -111,7 +111,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
|
||||
if (graph.children(v).length > 0) {
|
||||
// This is a cluster but not to be rendered recursively
|
||||
// Render as before
|
||||
log.info(
|
||||
log.trace(
|
||||
'Cluster - the non recursive path XBX',
|
||||
v,
|
||||
node.id,
|
||||
@ -120,11 +120,11 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
|
||||
'Graph:',
|
||||
graph
|
||||
);
|
||||
log.info(findNonClusterChild(node.id, graph));
|
||||
log.trace(findNonClusterChild(node.id, graph));
|
||||
clusterDb.set(node.id, { id: findNonClusterChild(node.id, graph), node });
|
||||
// insertCluster(clusters, graph.node(v));
|
||||
} else {
|
||||
log.warn('Node - the non recursive path XAX', v, nodes, graph.node(v), dir);
|
||||
log.trace('Node - the non recursive path XAX', v, nodes, graph.node(v), dir);
|
||||
await insertNode(nodes, graph.node(v), dir);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user