From 5d942eec41cff54d8bde7eadba13fd281710cbb9 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Mon, 30 Dec 2024 16:38:36 -0800 Subject: [PATCH] Mermaid: update to 11.4.1 --- src/modules/blocks/code/code-renderers/RenderCodeMermaid.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/blocks/code/code-renderers/RenderCodeMermaid.tsx b/src/modules/blocks/code/code-renderers/RenderCodeMermaid.tsx index b4f51d5a4..0ae0e8264 100644 --- a/src/modules/blocks/code/code-renderers/RenderCodeMermaid.tsx +++ b/src/modules/blocks/code/code-renderers/RenderCodeMermaid.tsx @@ -19,7 +19,7 @@ import { patchSvgString } from './RenderCodeSVG'; * If you update this file, also make sure the interfaces/type definitions and initialization * options are updated accordingly. */ -const MERMAID_CDN_FILE: string = 'https://cdn.jsdelivr.net/npm/mermaid@11.2.1/dist/mermaid.min.js'; +const MERMAID_CDN_FILE: string = 'https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.min.js'; const MERMAID_ERROR_PREFIX: string = '[Mermaid]'; interface MermaidAPI { @@ -134,7 +134,7 @@ export function RenderCodeMermaid(props: { mermaidCode: string, fitScreen: boole try { const elementId = `mermaid-${Math.random().toString(36).substring(2, 9)}`; const { svg } = await mermaidAPI!.render(elementId, props.mermaidCode, mermaidContainerRef.current!); - return svg; + return svg ? svg : MERMAID_ERROR_PREFIX + ' no SVG.'; } catch (error: any) { return MERMAID_ERROR_PREFIX + ' ' + (error?.message || 'invalid.'); }