Skip to content

Commit

Permalink
fix: flowchart image without text
Browse files Browse the repository at this point in the history
  • Loading branch information
bonyuta0204 committed Nov 23, 2023
1 parent 4a4e614 commit 9cf21b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/mermaid/src/dagre-wrapper/shapes/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const labelHelper = async (parent, node, _classes, isNode) => {

// if there are images, need to wait for them to load before getting the bounding box
const images = div.getElementsByTagName('img');
console.log('images', images);

Check failure on line 63 in packages/mermaid/src/dagre-wrapper/shapes/util.js

View workflow job for this annotation

GitHub Actions / lint (18.x)

Unexpected console statement
if (images) {
const noImgText = labelText.replace(/<img[^>]*>/g, '').trim() === '';

Expand All @@ -80,7 +81,9 @@ export const labelHelper = async (parent, node, _classes, isNode) => {
? getConfig().fontSize
: window.getComputedStyle(document.body).fontSize;
const enlargingFactor = 5;
img.style.width = parseInt(bodyFontSize, 10) * enlargingFactor + 'px';
const width = parseInt(bodyFontSize, 10) * enlargingFactor + 'px';
img.style.minWidth = width;
img.style.maxWidth = width;
} else {
img.style.width = '100%';
}
Expand Down

0 comments on commit 9cf21b5

Please sign in to comment.