Skip to content

Commit

Permalink
add bindFunctions support
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Jul 26, 2020
1 parent c55ff49 commit ddfe050
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web_src/js/markdown/mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ export async function renderMermaid(els) {
});

for (const el of els) {
mermaidAPI.render(`mermaid-${random(12)}`, el.textContent, (svg) => {
mermaidAPI.render(`mermaid-${random(12)}`, el.textContent, (svg, bindFunctions) => {
const div = document.createElement('div');
div.classList.add('mermaid-chart');
div.innerHTML = svg;
if (typeof bindFunctions === 'function') bindFunctions(div);
el.closest('pre').replaceWith(div);
});
}
Expand Down

0 comments on commit ddfe050

Please sign in to comment.