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,10 +144,12 @@ 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 () {
if (mermaid.startOnLoad) {
const { startOnLoad } = mermaidAPI.getConfig(); const { startOnLoad } = mermaidAPI.getConfig();
if (startOnLoad) { if (startOnLoad) {
mermaid.init(); mermaid.init();
} }
}
}; };
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
@ -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,