mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 02:22:26 +08:00
fix(mermaid): load ELK in previews
This commit is contained in:
parent
2ef956da87
commit
1dec64c712
@ -12,6 +12,7 @@ import FAttachment from "../entities/fattachment.js";
|
|||||||
import imageContextMenuService from "../menus/image_context_menu.js";
|
import imageContextMenuService from "../menus/image_context_menu.js";
|
||||||
import { applySingleBlockSyntaxHighlight, applySyntaxHighlight } from "./syntax_highlight.js";
|
import { applySingleBlockSyntaxHighlight, applySyntaxHighlight } from "./syntax_highlight.js";
|
||||||
import mime_types from "./mime_types.js";
|
import mime_types from "./mime_types.js";
|
||||||
|
import { loadElkIfNeeded } from "./mermaid.js";
|
||||||
|
|
||||||
let idCounter = 1;
|
let idCounter = 1;
|
||||||
|
|
||||||
@ -237,6 +238,7 @@ async function renderMermaid(note, $renderedContent) {
|
|||||||
mermaid.mermaidAPI.initialize({startOnLoad: false, theme: mermaidTheme.trim(), securityLevel: 'antiscript'});
|
mermaid.mermaidAPI.initialize({startOnLoad: false, theme: mermaidTheme.trim(), securityLevel: 'antiscript'});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
await loadElkIfNeeded(content);
|
||||||
const {svg} = await mermaid.mermaidAPI.render("in-mermaid-graph-" + idCounter++, content);
|
const {svg} = await mermaid.mermaidAPI.render("in-mermaid-graph-" + idCounter++, content);
|
||||||
|
|
||||||
$renderedContent.append($(svg));
|
$renderedContent.append($(svg));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user