From 0f56c9a85dbb098870f7e08fd94344278d240660 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Fri, 9 Sep 2022 13:37:37 +0200 Subject: [PATCH] Fix for issue #3428, load the configured diagrams even when initialize has not been called. --- package.json | 4 ++-- src/mermaidAPI.js | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1efc62c51..4cf174f3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mermaid", - "version": "9.1.6", + "version": "9.1.7", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "main": "dist/mermaid.min.js", "module": "dist/mermaid.esm.min.mjs", @@ -122,4 +122,4 @@ "**/*.css", "**/*.scss" ] -} \ No newline at end of file +} diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 016fbde1c..fab424d26 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -146,6 +146,10 @@ export const decodeEntities = function (text) { * @returns {any} */ const render = function (id, _txt, cb, container) { + if (!hasLoadedDiagrams) { + addDiagrams(); + hasLoadedDiagrams = true; + } configApi.reset(); let txt = _txt.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;; const graphInit = utils.detectInit(txt);