mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-23 10:16:43 +02:00
#5787 Fix for issue with labels in firefox
This commit is contained in:
5
.changeset/dry-plums-glow.md
Normal file
5
.changeset/dry-plums-glow.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix for issue with calculation of label width when using in firefox
|
@@ -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,
|
||||||
|
Reference in New Issue
Block a user