fix: startOnLoad

This commit is contained in:
Sidharth Vinod 2022-08-21 19:32:21 +05:30
parent a51d8e844b
commit d97b3807b9
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD

View File

@ -144,9 +144,11 @@ const initialize = function (config: MermaidConfig) {
* configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the page. * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the page.
*/ */
const contentLoaded = function () { const contentLoaded = function () {
const { startOnLoad } = mermaidAPI.getConfig(); if (mermaid.startOnLoad) {
if (startOnLoad) { const { startOnLoad } = mermaidAPI.getConfig();
mermaid.init(); if (startOnLoad) {
mermaid.init();
}
} }
}; };
@ -183,6 +185,7 @@ const setParseErrorHandler = function (newParseErrorHandler: (err: any, hash: an
}; };
const mermaid = { const mermaid = {
startOnLoad: true,
diagrams: {}, diagrams: {},
mermaidAPI, mermaidAPI,
parse: mermaidAPI != undefined ? mermaidAPI.parse : null, parse: mermaidAPI != undefined ? mermaidAPI.parse : null,