mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Upgraded Mermaid to 10.6.1
Upgrade to Mermaid 10.6.1
This commit is contained in:
commit
544aa76db5
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -252,7 +252,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.6c14ae12.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.50eae0f4.min.js' | url }}"></script>
|
||||||
{% for script in config.extra_javascript %}
|
{% for script in config.extra_javascript %}
|
||||||
{{ script | script_tag }}
|
{{ script | script_tag }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -69,7 +69,7 @@ let sequence = 0
|
|||||||
*/
|
*/
|
||||||
function fetchScripts(): Observable<void> {
|
function fetchScripts(): Observable<void> {
|
||||||
return typeof mermaid === "undefined" || mermaid instanceof Element
|
return typeof mermaid === "undefined" || mermaid instanceof Element
|
||||||
? watchScript("https://unpkg.com/mermaid@9.4.3/dist/mermaid.min.js")
|
? watchScript("https://unpkg.com/mermaid@10.6.1/dist/mermaid.min.js")
|
||||||
: of(undefined)
|
: of(undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ export function mountMermaid(
|
|||||||
)
|
)
|
||||||
|
|
||||||
/* Render diagram */
|
/* Render diagram */
|
||||||
mermaid$.subscribe(() => {
|
mermaid$.subscribe(async () => {
|
||||||
el.classList.add("mermaid") // Hack: mitigate https://bit.ly/3CiN6Du
|
el.classList.add("mermaid") // Hack: mitigate https://bit.ly/3CiN6Du
|
||||||
const id = `__mermaid_${sequence++}`
|
const id = `__mermaid_${sequence++}`
|
||||||
|
|
||||||
@ -113,16 +113,15 @@ export function mountMermaid(
|
|||||||
const text = el.textContent
|
const text = el.textContent
|
||||||
|
|
||||||
/* Render and inject diagram */
|
/* Render and inject diagram */
|
||||||
mermaid.mermaidAPI.render(id, text, (svg: string, fn: Function) => {
|
const { svg, fn } = await mermaid.render(id, text)
|
||||||
|
|
||||||
/* Create a shadow root and inject diagram */
|
/* Create a shadow root and inject diagram */
|
||||||
const shadow = host.attachShadow({ mode: "closed" })
|
const shadow = host.attachShadow({ mode: "closed" })
|
||||||
shadow.innerHTML = svg
|
shadow.innerHTML = svg
|
||||||
|
|
||||||
/* Replace code block with diagram and bind functions */
|
/* Replace code block with diagram and bind functions */
|
||||||
el.replaceWith(host)
|
el.replaceWith(host)
|
||||||
fn?.(shadow)
|
fn?.(shadow)
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/* Create and return component */
|
/* Create and return component */
|
||||||
|
Loading…
Reference in New Issue
Block a user