Skip to content

Commit

Permalink
fix: long strings in firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Singh1 committed Jul 17, 2024
1 parent b1b480a commit 46d612d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/mermaid/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/mermaid/src/dagre-wrapper/shapes/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions packages/mermaid/src/rendering-util/createText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 46d612d

Please sign in to comment.