This commit is contained in:
Igor Agapov 2025-05-01 13:24:21 +02:00 committed by GitHub
commit 496cdd34b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@ You'll need to supply `onSelect()` to handle opening of your collaboration dialo
```tsx live ```tsx live
function App() { function App() {
const [excalidrawAPI, setExcalidrawAPI] = useState(null); const [excalidrawAPI, setExcalidrawAPI] = useState<ExcalidrawImperativeAPI>();
const [isCollaborating, setIsCollaborating] = useState(false); const [isCollaborating, setIsCollaborating] = useState(false);
return ( return (
<div style={{ height: "500px" }}> <div style={{ height: "500px" }}>
@ -33,9 +33,9 @@ function App() {
username: "Pika", username: "Pika",
avatarUrl: "../../../../img/pika.jpeg", avatarUrl: "../../../../img/pika.jpeg",
}); });
excalidrawAPI.updateScene({ collaborators }); excalidrawAPI?.updateScene({ collaborators });
} else { } else {
excalidrawAPI.updateScene({ excalidrawAPI?.updateScene({
collaborators: new Map(), collaborators: new Map(),
}); });
} }
@ -45,7 +45,7 @@ function App() {
Show Collaborators Show Collaborators
</label> </label>
<Excalidraw <Excalidraw
ref={(api) => setExcalidrawAPI(api)} excalidrawAPI={(api) => setExcalidrawAPI(api)}
renderTopRightUI={() => ( renderTopRightUI={() => (
<LiveCollaborationTrigger <LiveCollaborationTrigger
isCollaborating={isCollaborating} isCollaborating={isCollaborating}