diff --git a/src/components/Diagram/index.tsx b/src/components/Diagram/index.tsx index 658faf9..d951ff9 100644 --- a/src/components/Diagram/index.tsx +++ b/src/components/Diagram/index.tsx @@ -6,51 +6,53 @@ interface DiagramProps { } export default function Diagram({ diagramPath }: DiagramProps) { - - {() => { - const { Excalidraw, loadFromBlob } = - require("@excalidraw/excalidraw") as typeof import("@excalidraw/excalidraw"); - const { useState, useEffect } = - require("react") as typeof import("react"); + return ( + + {() => { + const { Excalidraw, loadFromBlob } = + require("@excalidraw/excalidraw") as typeof import("@excalidraw/excalidraw"); + const { useState, useEffect } = + require("react") as typeof import("react"); - function ExcalidrawDiagram({ diagramPath }: DiagramProps) { - const [excalidrawAPI, setExcalidrawAPI] = - useState(null); + function ExcalidrawDiagram({ diagramPath }: DiagramProps) { + const [excalidrawAPI, setExcalidrawAPI] = + useState(null); - useEffect(() => { - if (excalidrawAPI !== null) { - fetch(diagramPath) - .then((res) => res.blob()) - .then((blob) => - loadFromBlob(blob, excalidrawAPI.getAppState(), null) - ) - .then((data) => { - excalidrawAPI.updateScene(data); - }); - } - }, [excalidrawAPI]); + useEffect(() => { + if (excalidrawAPI !== null) { + fetch(diagramPath) + .then((res) => res.blob()) + .then((blob) => + loadFromBlob(blob, excalidrawAPI.getAppState(), null) + ) + .then((data) => { + excalidrawAPI.updateScene(data); + }); + } + }, [excalidrawAPI]); - return ( -
- setExcalidrawAPI(api)} - isCollaborating={false} - zenModeEnabled={false} - viewModeEnabled={true} - gridModeEnabled={false} - UIOptions={{ - canvasActions: { - export: false, - loadScene: false, - saveToActiveFile: false, - }, - }} - /> -
- ); - } + return ( +
+ setExcalidrawAPI(api)} + isCollaborating={false} + zenModeEnabled={false} + viewModeEnabled={true} + gridModeEnabled={false} + UIOptions={{ + canvasActions: { + export: false, + loadScene: false, + saveToActiveFile: false, + }, + }} + /> +
+ ); + } - return ; - }} -
; + return ; + }} +
+ ); } \ No newline at end of file