|
@@ -106,7 +106,6 @@ export default function App() {
|
|
onChange={(elements, state) => {
|
|
onChange={(elements, state) => {
|
|
console.log("Latest elements:", elements, "Latest state:", state);
|
|
console.log("Latest elements:", elements, "Latest state:", state);
|
|
}}
|
|
}}
|
|
- user={{ name: "Excalidraw User" }}
|
|
|
|
onPointerUpdate={(pointerData) => console.log(pointerData)}
|
|
onPointerUpdate={(pointerData) => console.log(pointerData)}
|
|
onCollabButtonClick={() => {
|
|
onCollabButtonClick={() => {
|
|
window.alert("You clicked on collab button");
|
|
window.alert("You clicked on collab button");
|
|
@@ -130,7 +129,6 @@ export default function App() {
|
|
| [`offsetTop`](#offsetTop) | Number | `0` | top position relative to which Excalidraw should render |
|
|
| [`offsetTop`](#offsetTop) | Number | `0` | top position relative to which Excalidraw should render |
|
|
| [`onChange`](#onChange) | Function | | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw elements and the current app state. |
|
|
| [`onChange`](#onChange) | Function | | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw elements and the current app state. |
|
|
| [`initialData`](#initialData) | <pre>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37">AppState<a> } </pre> | null | The initial data with which app loads. |
|
|
| [`initialData`](#initialData) | <pre>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37">AppState<a> } </pre> | null | The initial data with which app loads. |
|
|
-| [`user`](#user) | `{ name?: string }` | | User details. The name refers to the name of the user to be shown |
|
|
|
|
| [`excalidrawRef`](#excalidrawRef) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) or [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) or <pre>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</pre> | | Ref to be passed to Excalidraw |
|
|
| [`excalidrawRef`](#excalidrawRef) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) or [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) or <pre>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</pre> | | Ref to be passed to Excalidraw |
|
|
| [`onCollabButtonClick`](#onCollabButtonClick) | Function | | Callback to be triggered when the collab button is clicked |
|
|
| [`onCollabButtonClick`](#onCollabButtonClick) | Function | | Callback to be triggered when the collab button is clicked |
|
|
| [`isCollaborating`](#isCollaborating) | `boolean` | | This implies if the app is in collaboration mode |
|
|
| [`isCollaborating`](#isCollaborating) | `boolean` | | This implies if the app is in collaboration mode |
|
|
@@ -257,10 +255,6 @@ This helps to load Excalidraw with `initialData`. It must be an object or a [pro
|
|
|
|
|
|
You might want to use this when you want to load excalidraw with some initial elements and app state.
|
|
You might want to use this when you want to load excalidraw with some initial elements and app state.
|
|
|
|
|
|
-#### `user`
|
|
|
|
-
|
|
|
|
-This is the user name which shows during collaboration. Defaults to `{name: ''}`.
|
|
|
|
-
|
|
|
|
#### `excalidrawRef`
|
|
#### `excalidrawRef`
|
|
|
|
|
|
You can pass a `ref` when you want to access some excalidraw APIs. We expose the below APIs:
|
|
You can pass a `ref` when you want to access some excalidraw APIs. We expose the below APIs:
|
|
@@ -269,7 +263,7 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
|
|
| --- | --- | --- |
|
|
| --- | --- | --- |
|
|
| ready | `boolean` | This is set to true once Excalidraw is rendered |
|
|
| ready | `boolean` | This is set to true once Excalidraw is rendered |
|
|
| readyPromise | [resolvablePromise](https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317) | This promise will be resolved with the api once excalidraw has rendered. This will be helpful when you want do some action on the host app once this promise resolves. For this to work you will have to pass ref as shown [here](#readyPromise) |
|
|
| readyPromise | [resolvablePromise](https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317) | This promise will be resolved with the api once excalidraw has rendered. This will be helpful when you want do some action on the host app once this promise resolves. For this to work you will have to pass ref as shown [here](#readyPromise) |
|
|
-| updateScene | <pre>(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L189">sceneData</a>)) => void </pre> | updates the scene with the sceneData |
|
|
|
|
|
|
+| updateScene | <pre>(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L192">sceneData</a>)) => void </pre> | updates the scene with the sceneData |
|
|
| resetScene | `({ resetLoadingState: boolean }) => void` | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false. |
|
|
| resetScene | `({ resetLoadingState: boolean }) => void` | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false. |
|
|
| getSceneElementsIncludingDeleted | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a></pre> | Returns all the elements including the deleted in the scene |
|
|
| getSceneElementsIncludingDeleted | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a></pre> | Returns all the elements including the deleted in the scene |
|
|
| getSceneElements | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a></pre> | Returns all the elements excluding the deleted in the scene |
|
|
| getSceneElements | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a></pre> | Returns all the elements excluding the deleted in the scene |
|