From 96516d6dd5951c7f070683bd75fbbf45743ad020 Mon Sep 17 00:00:00 2001 From: Jim Yang Date: Thu, 18 Apr 2019 10:46:52 +0100 Subject: [PATCH 1/3] Fix issue with XML line breaks inside vertex labels The regex needed to match the `
` or `
` wasn't completely correct since some browsers (e.g. Chrome) attempt to turn `
` elements into their XHTML counter-parts: `
`. This fixes the regex so both will match. --- src/diagrams/flowchart/flowRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index ae6b1caed6..ee480fd325 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -74,7 +74,7 @@ export const addVertices = function (vert, g) { } else { const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text') - const rows = verticeText.split(/
/) + const rows = verticeText.split(//) for (let j = 0; j < rows.length; j++) { const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan') From b2c833b879f296a84a1a98c59dfe37dd23ef8537 Mon Sep 17 00:00:00 2001 From: Jim Yang Date: Thu, 18 Apr 2019 18:38:33 +0100 Subject: [PATCH 2/3] Remove escape inside regex for StandardJS --- src/diagrams/flowchart/flowRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index ee480fd325..46975a8688 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -74,7 +74,7 @@ export const addVertices = function (vert, g) { } else { const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text') - const rows = verticeText.split(//) + const rows = verticeText.split(//) for (let j = 0; j < rows.length; j++) { const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan') From fa9cf2b3458e0b094e3e1af2252a7426ac796359 Mon Sep 17 00:00:00 2001 From: jsyang Date: Wed, 24 Apr 2019 16:31:09 +0100 Subject: [PATCH 3/3] Fix line styling (dashed / thick) when not using HTML labels option --- src/diagrams/flowchart/flowRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index 46975a8688..f036a5a66c 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -203,7 +203,7 @@ export const addEdges = function (edges, g) { edgeData.label = '' + edge.text + '' } else { edgeData.labelType = 'text' - edgeData.style = 'stroke: #333; stroke-width: 1.5px;fill:none' + edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none' edgeData.label = edge.text.replace(/
/g, '\n') } } else {