mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Add initThrowsErrors() (#2379)
* Add initThrowsErrors() * Update mermaid.js * Update mermaid.js
This commit is contained in:
parent
fb82a5be46
commit
473aced449
@ -30,6 +30,18 @@ import utils from './utils';
|
||||
* Renders the mermaid diagrams
|
||||
*/
|
||||
const init = function () {
|
||||
try {
|
||||
initThrowsErrors();
|
||||
} catch (e) {
|
||||
log.warn('Syntax Error rendering');
|
||||
log.warn(e);
|
||||
if (this.parseError) {
|
||||
this.parseError(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const initThrowsErrors = function () {
|
||||
const conf = mermaidAPI.getConfig();
|
||||
// console.log('Starting rendering diagrams (init) - mermaid.init', conf);
|
||||
let nodes;
|
||||
@ -109,26 +121,18 @@ const init = function () {
|
||||
log.debug('Detected early reinit: ', init);
|
||||
}
|
||||
|
||||
try {
|
||||
mermaidAPI.render(
|
||||
id,
|
||||
txt,
|
||||
(svgCode, bindFunctions) => {
|
||||
element.innerHTML = svgCode;
|
||||
if (typeof callback !== 'undefined') {
|
||||
callback(id);
|
||||
}
|
||||
if (bindFunctions) bindFunctions(element);
|
||||
},
|
||||
element
|
||||
);
|
||||
} catch (e) {
|
||||
log.warn('Syntax Error rendering');
|
||||
log.warn(e);
|
||||
if (this.parseError) {
|
||||
this.parseError(e);
|
||||
}
|
||||
}
|
||||
mermaidAPI.render(
|
||||
id,
|
||||
txt,
|
||||
(svgCode, bindFunctions) => {
|
||||
element.innerHTML = svgCode;
|
||||
if (typeof callback !== 'undefined') {
|
||||
callback(id);
|
||||
}
|
||||
if (bindFunctions) bindFunctions(element);
|
||||
},
|
||||
element
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user