Added the option to disable auto rendering via the mermaid namespace as described in issue #91

Added optional ; as statement separator equal to newline for sequence diagrams (help for tidy users)
This commit is contained in:
knsv
2015-01-06 19:33:00 +01:00
parent 222a6e0682
commit c5c995c916
11 changed files with 227 additions and 115 deletions

View File

@@ -91,28 +91,9 @@ var equals = function (val, variable){
return (val === variable);
}
};
if(typeof document !== 'undefined'){
/**
* Wait for coument loaded before starting the execution
*/
document.addEventListener('DOMContentLoaded', function(){
// Check presence of config object
if(typeof mermaid_config !== 'undefined'){
// Check if property startOnLoad is set
if(equals(true, mermaid_config.startOnLoad)){
init();
}
}
else{
// No config found, do autostart in this simple case
init();
}
}, false);
}
global.mermaid = {
startOnLoad:true,
init:function(){
init();
},
@@ -122,4 +103,36 @@ global.mermaid = {
getParser:function(){
return flow.parser;
}
};
};
exports.contentLoaded = function(){
// Check state of start config mermaid namespece
//console.log('global.mermaid.startOnLoad',global.mermaid.startOnLoad);
//console.log('mermaid_config',mermaid_config);
if(global.mermaid.startOnLoad) {
// For backwards compatability reasons also check mermaid_config variable
if (typeof mermaid_config !== 'undefined') {
// Check if property startOnLoad is set
if (equals(true, mermaid_config.startOnLoad)) {
global.mermaid.init();
}
}
else {
// No config found, do autostart in this simple case
global.mermaid.init();
}
}
};
if(typeof document !== 'undefined'){
/**
* Wait for coument loaded before starting the execution
*/
document.addEventListener('DOMContentLoaded', function(){
exports.contentLoaded();
}, false);
}