From 83b71638447023bc4b70c39392916d3efe4779dc Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 21 Jul 2019 08:19:50 -0700 Subject: [PATCH 1/4] Fix text label colors for flow charts When htmlLabels is set to `false` and a background fill color is used for a node, the text label will inherit the fill color, hiding the actual text. To fix this, explicitly set the fill color to `#333`, the same value used in `src/themes/flowchart.scss`. Closes https://github.com/knsv/mermaid/issues/885 --- src/diagrams/flowchart/flowRenderer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index 3fb9a31f5..a2802c356 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -78,6 +78,7 @@ export const addVertices = function (vert, g, svgId) { tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve') tspan.setAttribute('dy', '1em') tspan.setAttribute('x', '1') + tspan.setAttribute('fill', '#333') tspan.textContent = rows[j] svgLabel.appendChild(tspan) } From c6502fb03ba0fe7cb1bfa316f0ce86a3573f258b Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 21 Jul 2019 08:49:21 -0700 Subject: [PATCH 2/4] Style the flow chart labels via SCSS --- src/diagrams/flowchart/flowRenderer.js | 1 - src/themes/flowchart.scss | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/diagrams/flowchart/flowRenderer.js b/src/diagrams/flowchart/flowRenderer.js index a2802c356..3fb9a31f5 100644 --- a/src/diagrams/flowchart/flowRenderer.js +++ b/src/diagrams/flowchart/flowRenderer.js @@ -78,7 +78,6 @@ export const addVertices = function (vert, g, svgId) { tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve') tspan.setAttribute('dy', '1em') tspan.setAttribute('x', '1') - tspan.setAttribute('fill', '#333') tspan.textContent = rows[j] svgLabel.appendChild(tspan) } diff --git a/src/themes/flowchart.scss b/src/themes/flowchart.scss index 7f8a98f9d..91456bcad 100644 --- a/src/themes/flowchart.scss +++ b/src/themes/flowchart.scss @@ -3,6 +3,10 @@ color: #333; } +.label text { + fill: #333; +} + .node rect, .node circle, .node ellipse, From e9f4ac7425f7b3aadfc809f97b49a666f56a3093 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 21 Jul 2019 09:16:47 -0700 Subject: [PATCH 3/4] Fix typo: wich -> which --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 312064f2c..57118aec5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Special note regarding version 8.2 -In version 8.2 a security improvement was introduced. A securityLevel configuration was introduced wich sets the level of trust to be used on the parsed diagrams. +In version 8.2 a security improvement was introduced. A securityLevel configuration was introduced which sets the level of trust to be used on the parsed diagrams. * **true**: (default) tags in text are encoded, click functionality is disabled * false: tags in text are allowed, click functionality is enabledClosed issues: From 527aea926421e54d272a1edc2351a261641ff099 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 21 Jul 2019 09:46:35 -0700 Subject: [PATCH 4/4] Fix securityLevel documentation Instead of boolean values, only `strict` and `loose` should be used. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 57118aec5..6f3622ddd 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ In version 8.2 a security improvement was introduced. A securityLevel configuration was introduced which sets the level of trust to be used on the parsed diagrams. -* **true**: (default) tags in text are encoded, click functionality is disabled -* false: tags in text are allowed, click functionality is enabledClosed issues: +* **`strict`**: (default) tags in text are encoded, click functionality is disabled +* `loose`: tags in text are allowed, click functionality is enabledClosed issues: ⚠️ **Note** : This changes the default behaviour of mermaid so that after upgrade to 8.2, if the securityLevel is not configured, tags in flowcharts are encoded as tags and clicking is prohibited.