mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Making sure to addDiagrams before detectType call
This commit is contained in:
parent
b21cb43639
commit
a9e798c399
@ -41,7 +41,7 @@ import assignWithDepth from './assignWithDepth';
|
|||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
import mermaid from './mermaid';
|
import mermaid from './mermaid';
|
||||||
|
|
||||||
addDiagrams();
|
let hasLoadedDiagrams = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param text
|
* @param text
|
||||||
@ -49,7 +49,12 @@ addDiagrams();
|
|||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
function parse(text, dia) {
|
function parse(text, dia) {
|
||||||
|
if (!hasLoadedDiagrams) {
|
||||||
|
addDiagrams();
|
||||||
|
hasLoadedDiagrams = true;
|
||||||
|
}
|
||||||
var parseEncounteredException = false;
|
var parseEncounteredException = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const diag = dia ? dia : new Diagram(text);
|
const diag = dia ? dia : new Diagram(text);
|
||||||
diag.db.clear();
|
diag.db.clear();
|
||||||
@ -515,6 +520,10 @@ function initialize(options) {
|
|||||||
|
|
||||||
updateRendererConfigs(config);
|
updateRendererConfigs(config);
|
||||||
setLogLevel(config.logLevel);
|
setLogLevel(config.logLevel);
|
||||||
|
if (!hasLoadedDiagrams) {
|
||||||
|
addDiagrams();
|
||||||
|
hasLoadedDiagrams = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mermaidAPI = Object.freeze({
|
const mermaidAPI = Object.freeze({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user