Fix for issue #3428, load the configured diagrams even when initialize has not been called.

This commit is contained in:
Knut Sveidqvist 2022-09-09 13:37:37 +02:00
parent e5212c25f5
commit 0f56c9a85d
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "mermaid", "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.", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "dist/mermaid.min.js", "main": "dist/mermaid.min.js",
"module": "dist/mermaid.esm.min.mjs", "module": "dist/mermaid.esm.min.mjs",
@ -122,4 +122,4 @@
"**/*.css", "**/*.css",
"**/*.scss" "**/*.scss"
] ]
} }

View File

@ -146,6 +146,10 @@ export const decodeEntities = function (text) {
* @returns {any} * @returns {any}
*/ */
const render = function (id, _txt, cb, container) { const render = function (id, _txt, cb, container) {
if (!hasLoadedDiagrams) {
addDiagrams();
hasLoadedDiagrams = true;
}
configApi.reset(); configApi.reset();
let txt = _txt.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;; let txt = _txt.replace(/\r\n?/g, '\n'); // parser problems on CRLF ignore all CR and leave LF;;
const graphInit = utils.detectInit(txt); const graphInit = utils.detectInit(txt);