This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from janhq/pena-patch
Update Cortex Docs
- Loading branch information
Showing
22 changed files
with
7,272 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
import { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types/types"; | ||
|
||
interface DiagramProps { | ||
diagramPath: string; | ||
} | ||
|
||
export default function Diagram({ diagramPath }: DiagramProps) { | ||
return ( | ||
<BrowserOnly> | ||
{() => { | ||
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<ExcalidrawImperativeAPI | null>(null); | ||
|
||
useEffect(() => { | ||
if (excalidrawAPI !== null) { | ||
fetch(diagramPath) | ||
.then((res) => res.blob()) | ||
.then((blob) => | ||
loadFromBlob(blob, excalidrawAPI.getAppState(), null) | ||
) | ||
.then((data) => { | ||
excalidrawAPI.updateScene(data); | ||
}); | ||
} | ||
}, [excalidrawAPI]); | ||
|
||
return ( | ||
<div style={{ height: "600px" }}> | ||
<Excalidraw | ||
excalidrawAPI={(api) => setExcalidrawAPI(api)} | ||
isCollaborating={false} | ||
zenModeEnabled={false} | ||
viewModeEnabled={true} | ||
gridModeEnabled={false} | ||
UIOptions={{ | ||
canvasActions: { | ||
export: false, | ||
loadScene: false, | ||
saveToActiveFile: false, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
return <ExcalidrawDiagram diagramPath={diagramPath} />; | ||
}} | ||
</BrowserOnly> | ||
); | ||
} |
Oops, something went wrong.