mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
fix(mermaid): Add await to render in init.
This commit is contained in:
@@ -13,39 +13,39 @@
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: flex">
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
graph TB
|
||||
FunctionTest1-->URLTest1
|
||||
click FunctionTest1 clickByFlow "Add a div"
|
||||
click URLTest1 "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>"
|
||||
</pre>
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
graph TB
|
||||
1Function--->2URL
|
||||
click 1Function clickByFlow "Add a div"
|
||||
click 2URL "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>"
|
||||
</pre>
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
flowchart TB
|
||||
FunctionTest2-->URLTest2
|
||||
click FunctionTest2 clickByFlow "Add a div"
|
||||
click URLTest2 "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>" _self
|
||||
</pre>
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
flowchart TB
|
||||
10Function--->20URL
|
||||
click 10Function clickByFlow "Add a div"
|
||||
click 20URL "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>" _self
|
||||
</pre>
|
||||
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class ShapeLink
|
||||
link ShapeLink "http://localhost:9000/webpackUsage.html" "This is a tooltip for a link"
|
||||
class ShapeCallback
|
||||
callback ShapeCallback "clickByClass" "This is a tooltip for a callback"
|
||||
</pre>
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
classDiagram-v2
|
||||
class ShapeLink2
|
||||
link ShapeLink2 "http://localhost:9000/webpackUsage.html" "This is a tooltip for a link"
|
||||
@@ -95,20 +95,20 @@
|
||||
Add another diagram to demo page : 48h
|
||||
</pre>
|
||||
<div style="display: flex">
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
graph TB
|
||||
FunctionArgTest2-->URL
|
||||
click FunctionArgTest2 call clickByFlowArg(ARGUMENT) "Add a div"
|
||||
click URL "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>"
|
||||
</pre>
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
flowchart TB
|
||||
2FunctionArg-->URL
|
||||
click 2FunctionArg call clickByFlowArg(ARGUMENT) "Add a div"
|
||||
click URL "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>"
|
||||
</pre>
|
||||
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
classDiagram
|
||||
class ShapeLink
|
||||
link ShapeLink "http://localhost:9000/webpackUsage.html" "This is a tooltip for a link"
|
||||
@@ -116,7 +116,7 @@
|
||||
click ShapeCallback call clickByClass(123) "This is a tooltip for a callback"
|
||||
</pre>
|
||||
|
||||
<pre id="FirstLine" class="mermaid">
|
||||
<pre class="mermaid">
|
||||
classDiagram-v2
|
||||
class ShapeLink2
|
||||
link ShapeLink2 "http://localhost:9000/webpackUsage.html" "This is a tooltip for a link"
|
||||
|
@@ -45,7 +45,7 @@ import { isDetailedError } from './utils';
|
||||
* @param nodes
|
||||
* @param callback
|
||||
*/
|
||||
const init = function (
|
||||
const init = async function (
|
||||
config?: MermaidConfig,
|
||||
// eslint-disable-next-line no-undef
|
||||
nodes?: string | HTMLElement | NodeListOf<HTMLElement>,
|
||||
@@ -69,7 +69,7 @@ const init = function (
|
||||
}
|
||||
};
|
||||
|
||||
const initThrowsErrors = function (
|
||||
const initThrowsErrors = async function (
|
||||
config?: MermaidConfig,
|
||||
// eslint-disable-next-line no-undef
|
||||
nodes?: string | HTMLElement | NodeListOf<HTMLElement>,
|
||||
@@ -108,7 +108,7 @@ const initThrowsErrors = function (
|
||||
// generate the id of the diagram
|
||||
const idGenerator = new utils.initIdGenerator(conf.deterministicIds, conf.deterministicIDSeed);
|
||||
|
||||
let txt;
|
||||
let txt: string;
|
||||
const errors = [];
|
||||
|
||||
// element is the current div with mermaid class
|
||||
@@ -136,7 +136,7 @@ const initThrowsErrors = function (
|
||||
log.debug('Detected early reinit: ', init);
|
||||
}
|
||||
try {
|
||||
mermaidAPI.render(
|
||||
await mermaidAPI.render(
|
||||
id,
|
||||
txt,
|
||||
(svgCode: string, bindFunctions?: (el: Element) => void) => {
|
||||
|
Reference in New Issue
Block a user