Merge pull request #5865 from mermaid-js/develop

Pre-Release
This commit is contained in:
Sidharth Vinod 2024-09-16 22:06:35 +05:30 committed by GitHub
commit 14601b7871
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 351 additions and 591 deletions

View File

@ -0,0 +1,5 @@
---
'mermaid': patch
---
Fix for issue with calculation of label width when using in firefox

View File

@ -329,7 +329,7 @@ export const fixLifeLineHeights = (diagram, actors, actorKeys, conf) => {
const drawActorTypeParticipant = function (elem, actor, conf, isFooter) { const drawActorTypeParticipant = function (elem, actor, conf, isFooter) {
const actorY = isFooter ? actor.stopy : actor.starty; const actorY = isFooter ? actor.stopy : actor.starty;
const center = actor.x + actor.width / 2; const center = actor.x + actor.width / 2;
const centerY = actorY + 5; const centerY = actorY + actor.height;
const boxplusLineGroup = elem.append('g').lower(); const boxplusLineGroup = elem.append('g').lower();
var g = boxplusLineGroup; var g = boxplusLineGroup;

View File

@ -20,6 +20,11 @@ function applyStyle(dom, styleFn) {
async function addHtmlSpan(element, node, width, classes, addBackground = false) { async function addHtmlSpan(element, node, width, classes, addBackground = false) {
const fo = element.append('foreignObject'); const fo = element.append('foreignObject');
// This is not the final width but used in order to make sure the foreign
// object in firefox gets a width at all. The final width is fetched from the div
fo.attr('width', `${10 * width}px`);
fo.attr('height', `${10 * width}px`);
const div = fo.append('xhtml:div'); const div = fo.append('xhtml:div');
let label = node.label; let label = node.label;
if (node.label && hasKatex(node.label)) { if (node.label && hasKatex(node.label)) {
@ -201,7 +206,7 @@ export const createText = async (
} = {}, } = {},
config: MermaidConfig config: MermaidConfig
) => { ) => {
log.info( log.debug(
'XYZ createText', 'XYZ createText',
text, text,
style, style,

928
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff