fix: Mermaid syntax error diagram sometimes displayed at side of document
ref https://github.com/outline/outline/discussions/5834
This commit is contained in:
@@ -62,14 +62,17 @@ function getNewState({
|
|||||||
theme: pluginState.isDark ? "dark" : "default",
|
theme: pluginState.isDark ? "dark" : "default",
|
||||||
fontFamily: "inherit",
|
fontFamily: "inherit",
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
module.default.render(
|
module.default.render(
|
||||||
"mermaid-diagram-" + diagramId,
|
"mermaid-diagram-" + diagramId,
|
||||||
block.node.textContent,
|
block.node.textContent,
|
||||||
(svgCode) => {
|
(svgCode, bindFunctions) => {
|
||||||
element.classList.remove("parse-error", "empty");
|
element.classList.remove("parse-error", "empty");
|
||||||
element.innerHTML = svgCode;
|
element.innerHTML = svgCode;
|
||||||
}
|
bindFunctions?.(element);
|
||||||
|
},
|
||||||
|
element
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const isEmpty = block.node.textContent.trim().length === 0;
|
const isEmpty = block.node.textContent.trim().length === 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user