mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-18 05:29:40 +02:00
Fix for issue #311, mermaid will clear div used for rendering initially in the redner function.
This commit is contained in:
40
test/examples/issue311_doueblRender.html
Normal file
40
test/examples/issue311_doueblRender.html
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
|
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="../../dist/mermaid.css"/>
|
||||||
|
<script src="dist/mermaidAPI.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
mermaidAPI.initialize({
|
||||||
|
startOnLoad: false,
|
||||||
|
logLevel: 1
|
||||||
|
});
|
||||||
|
$(function(){
|
||||||
|
// Example of using the API
|
||||||
|
|
||||||
|
|
||||||
|
var insertSvg = function(svgCode, bindFunctions){
|
||||||
|
// Rendering is completed so something with the svgCode
|
||||||
|
var element = document.querySelector("#resDiv");
|
||||||
|
element.innerHTML = svgCode;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var graphDefinition = 'graph TB\na-->b';
|
||||||
|
var graphDefinition2 = 'graph TB\nc-->d';
|
||||||
|
var element = document.querySelector("#resDiv");
|
||||||
|
var graph = mermaidAPI.render( 'graphDiv', graphDefinition, insertSvg, element);
|
||||||
|
|
||||||
|
element = document.querySelector("#resDiv");
|
||||||
|
graph = mermaidAPI.render( 'graphDiv', graphDefinition2, insertSvg, element);
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="resDiv"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user