diff --git a/cypress/integration/rendering/flowchart.spec.js b/cypress/integration/rendering/flowchart.spec.js
index 60f6cfbe2..9bc48a399 100644
--- a/cypress/integration/rendering/flowchart.spec.js
+++ b/cypress/integration/rendering/flowchart.spec.js
@@ -549,6 +549,8 @@ it('25: Handle link click events (link, anchor, mailto, other protocol, script)'
`graph LR
A[red
text] -->|red
text| B(blue
text)
C[/red
text/] -->|blue
text| D{blue
text}
+ E{{default
style}} -->|default
style| F([default
style])
+ linkStyle default color:Sienna;
linkStyle 0 color:red;
linkStyle 1 stroke:DarkGray,stroke-width:2px,color:#0000ff
style A color:red;
@@ -567,6 +569,8 @@ it('25: Handle link click events (link, anchor, mailto, other protocol, script)'
`graph LR
A[red
text] -->|red
text| B(blue
text)
C[/red
text/] -->|blue
text| D{blue
text}
+ E{{default
style}} -->|default
style| F([default
style])
+ linkStyle default color:Sienna;
linkStyle 0 color:red;
linkStyle 1 stroke:DarkGray,stroke-width:2px,color:#0000ff
style A color:red;
diff --git a/dist/index.html b/dist/index.html
index 9290199cc..e28890ce7 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -373,6 +373,8 @@ graph TB
graph LR
A[red
text] -->|red
text| B(blue
text)
C[/red
text/] -->|blue
text| D{blue
text}
+ E{{default
style}} -->|default
style| F([default
style])
+ linkStyle default color:Sienna;
linkStyle 0 color:red;
linkStyle 1 stroke:DarkGray,stroke-width:2px,color:#0000ff
style A color:red;
diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js
index b62c3ecbe..3a25e6e74 100644
--- a/src/diagrams/flowchart/flowRenderer.js
+++ b/src/diagrams/flowchart/flowRenderer.js
@@ -152,8 +152,12 @@ export const addEdges = function(edges, g) {
let cnt = 0;
let defaultStyle;
+ let defaultLabelStyle;
+
if (typeof edges.defaultStyle !== 'undefined') {
- defaultStyle = edges.defaultStyle.toString().replace(/,/g, ';');
+ const defaultStyles = getStylesFromArray(edges.defaultStyle);
+ defaultStyle = defaultStyles.style;
+ defaultLabelStyle = defaultStyles.labelStyle;
}
edges.forEach(function(edge) {
@@ -181,6 +185,9 @@ export const addEdges = function(edges, g) {
if (typeof defaultStyle !== 'undefined') {
style = defaultStyle;
}
+ if (typeof defaultLabelStyle !== 'undefined') {
+ labelStyle = defaultLabelStyle;
+ }
break;
case 'dotted':
style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
@@ -219,9 +226,9 @@ export const addEdges = function(edges, g) {
if (typeof edge.style === 'undefined') {
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
- } else {
- edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
}
+
+ edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
}
}
// Add the edge to the graph