From 46d612d1358d143865493de5e1f7dc2a3d647c4c Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Tue, 16 Jul 2024 18:41:45 -0700 Subject: [PATCH 1/2] fix: long strings in firefox --- packages/mermaid/package.json | 2 +- packages/mermaid/src/dagre-wrapper/shapes/util.js | 1 + packages/mermaid/src/rendering-util/createText.ts | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json index 982b9d0633..1f98aa1f3f 100644 --- a/packages/mermaid/package.json +++ b/packages/mermaid/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "11.0.0-alpha.7", + "version": "11.0.0-alpha.7+", "description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.", "type": "module", "module": "./dist/mermaid.core.mjs", diff --git a/packages/mermaid/src/dagre-wrapper/shapes/util.js b/packages/mermaid/src/dagre-wrapper/shapes/util.js index 1d0d2d77e6..7d1896c9a6 100644 --- a/packages/mermaid/src/dagre-wrapper/shapes/util.js +++ b/packages/mermaid/src/dagre-wrapper/shapes/util.js @@ -104,6 +104,7 @@ export const labelHelper = async (parent, node, _classes, isNode) => { bbox = div.getBoundingClientRect(); dv.attr('width', bbox.width); dv.attr('height', bbox.height); + dv.style('height', bbox.height + 'px'); } // Center the label diff --git a/packages/mermaid/src/rendering-util/createText.ts b/packages/mermaid/src/rendering-util/createText.ts index 462a4834f1..20625e7f4f 100644 --- a/packages/mermaid/src/rendering-util/createText.ts +++ b/packages/mermaid/src/rendering-util/createText.ts @@ -40,11 +40,14 @@ function addHtmlSpan(element, node, width, classes, addBackground = false) { div.style('display', 'table'); div.style('white-space', 'break-spaces'); div.style('width', width + 'px'); - bbox = div.node().getBoundingClientRect(); + const newBbox = div.node().getBoundingClientRect(); + if (newBbox.height > 0) { + bbox = newBbox; + } } - fo.style('width', bbox.width); - fo.style('height', bbox.height); + fo.style('width', bbox.width + 'px'); + fo.style('height', bbox.height + 'px'); return fo.node(); } From 590784221ac72950e8bc74eed44c8b693392a3d8 Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Tue, 16 Jul 2024 18:43:24 -0700 Subject: [PATCH 2/2] rm + in package.json --- packages/mermaid/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json index 1f98aa1f3f..982b9d0633 100644 --- a/packages/mermaid/package.json +++ b/packages/mermaid/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "11.0.0-alpha.7+", + "version": "11.0.0-alpha.7", "description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.", "type": "module", "module": "./dist/mermaid.core.mjs",