Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/lib/imageLightboxArchitecture.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ run('ready Mermaid images are native preview buttons backed by sanitized SVG det
assert.match(renderer, /theme,/);
assert.match(renderer, /target\.replaceChildren\(previewTrigger\)/);
assert.match(styles, /\.ace-mermaid-preview-trigger/);
assert.match(styles, /\.ace-mermaid-preview-trigger\s*\{[^}]*width: 100%/);
assert.match(styles, /\.ace-mermaid-preview-trigger\s*\{[^}]*width: max-content/);
assert.match(styles, /cursor: zoom-in/);
});

Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/mermaidRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ export function installMermaidRenderer(
});
image.className = 'ace-mermaid-svg';
image.alt = 'Mermaid diagram';
// SVG percentage widths are not intrinsic image sizes; use the parsed diagram width.
// Use the SVG viewBox dimensions at 1:1, independent of the container size.
image.style.width = `${result.width}px`;
image.style.height = `${result.height}px`;
image.width = Math.ceil(result.width);
image.height = Math.ceil(result.height);
image.decoding = 'async';
Expand Down
6 changes: 4 additions & 2 deletions web/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,8 @@ body {
}
.ace-mermaid-preview-trigger {
display: block;
width: 100%;
width: max-content;
min-width: 100%;
padding: 0;
border: 0;
outline: 0;
Expand All @@ -3210,7 +3211,8 @@ body {
display: block;
width: auto;
height: auto;
max-width: 100%;
max-width: none;
max-height: none;
margin: 0 auto;
pointer-events: none;
}
Expand Down
Loading