diff --git a/packages/mermaid/package.json b/packages/mermaid/package.json index 982b9d063..1f98aa1f3 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 1d0d2d77e..7d1896c9a 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 462a4834f..20625e7f4 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(); }