Upgrade MermaidJS (#5043
* Upgrade MermaidJS * fix: Flashing of diagrams while editing another * Upgrade vite * type imports
This commit is contained in:
@@ -76,23 +76,22 @@ function getNewState({
|
||||
theme: pluginState.isDark ? "dark" : "default",
|
||||
fontFamily: "inherit",
|
||||
});
|
||||
try {
|
||||
module.default.render(
|
||||
"mermaid-diagram-" + diagramId,
|
||||
block.node.textContent,
|
||||
(svgCode) => {
|
||||
element.innerHTML = svgCode;
|
||||
|
||||
module.default
|
||||
.render("mermaid-diagram-" + diagramId, block.node.textContent)
|
||||
.then(({ svg, bindFunctions }) => {
|
||||
element.innerHTML = svg;
|
||||
bindFunctions?.(element);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
const errorNode = document.getElementById(
|
||||
"d" + "mermaid-diagram-" + diagramId
|
||||
);
|
||||
if (errorNode) {
|
||||
element.appendChild(errorNode);
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
const errorNode = document.getElementById(
|
||||
"d" + "mermaid-diagram-" + diagramId
|
||||
);
|
||||
if (errorNode) {
|
||||
element.appendChild(errorNode);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return element;
|
||||
|
||||
Reference in New Issue
Block a user