From a573fbbb5a8a7537bcff4962d38d2ec6ee3c65de Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Tue, 29 Aug 2023 22:06:45 +0530 Subject: [PATCH] show error in preview when error --- src/components/MermaidToExcalidraw.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/MermaidToExcalidraw.tsx b/src/components/MermaidToExcalidraw.tsx index 716986855..6049bd81c 100644 --- a/src/components/MermaidToExcalidraw.tsx +++ b/src/components/MermaidToExcalidraw.tsx @@ -92,7 +92,16 @@ const MermaidToExcalidraw = ({ ); } catch (e) { console.error(e); - canvasNode.replaceChildren(); + 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(); + } } if (mermaidGraphData) { @@ -169,7 +178,7 @@ const MermaidToExcalidraw = ({ className="mermaid-to-excalidraw-wrapper-text" style={{ display: "flex", flexDirection: "column" }} > - +