show error in preview when error

This commit is contained in:
Aakansha Doshi 2023-08-29 22:06:45 +05:30
parent f696d36e03
commit a573fbbb5a

View File

@ -92,8 +92,17 @@ const MermaidToExcalidraw = ({
); );
} catch (e) { } catch (e) {
console.error(e); console.error(e);
if (text) {
const errorEle = document.createElement("div");
errorEle.innerHTML = "ERROR!!!!";
errorEle.style.color = "red";
errorEle.style.fontWeight = "800";
errorEle.style.fontSize = "40px";
canvasNode.replaceChildren(errorEle);
} else {
canvasNode.replaceChildren(); canvasNode.replaceChildren();
} }
}
if (mermaidGraphData) { if (mermaidGraphData) {
const { elements, files } = const { elements, files } =
@ -169,7 +178,7 @@ const MermaidToExcalidraw = ({
className="mermaid-to-excalidraw-wrapper-text" className="mermaid-to-excalidraw-wrapper-text"
style={{ display: "flex", flexDirection: "column" }} style={{ display: "flex", flexDirection: "column" }}
> >
<label>Describe</label> <label>Mermaid Syntax</label>
<textarea <textarea
style={{ style={{
padding: "0.85rem", padding: "0.85rem",