|
@@ -138,9 +138,6 @@ export default function App() {
|
|
|
console.log("Elements :", elements, "State : ", state)
|
|
|
}
|
|
|
onPointerUpdate={(payload) => console.log(payload)}
|
|
|
- onCollabButtonClick={() =>
|
|
|
- window.alert("You clicked on collab button")
|
|
|
- }
|
|
|
viewModeEnabled={viewModeEnabled}
|
|
|
zenModeEnabled={zenModeEnabled}
|
|
|
gridModeEnabled={gridModeEnabled}
|
|
@@ -331,7 +328,6 @@ const App = () => {
|
|
|
onChange: (elements, state) =>
|
|
|
console.log("Elements :", elements, "State : ", state),
|
|
|
onPointerUpdate: (payload) => console.log(payload),
|
|
|
- onCollabButtonClick: () => window.alert("You clicked on collab button"),
|
|
|
viewModeEnabled: viewModeEnabled,
|
|
|
zenModeEnabled: zenModeEnabled,
|
|
|
gridModeEnabled: gridModeEnabled,
|
|
@@ -655,6 +651,7 @@ The default menu items are:
|
|
|
|
|
|
- `<WelcomeScreen.Center.MenuItemHelp/>` - opens the help dialog.
|
|
|
- `<WelcomeScreen.Center.MenuItemLoadScene/>` - open the load file dialog.
|
|
|
+- `<WelcomeScreen.Center.MenuItemLiveCollaborationTrigger/>` - intended to open the live collaboration dialog. Works similarly to [`<LiveCollaborationTrigger>`](#LiveCollaborationTrigger) and you must supply `onSelect()` handler to integrate with your collaboration implementation.
|
|
|
|
|
|
**Usage**
|
|
|
|
|
@@ -719,6 +716,36 @@ Hint for the toolbar. Supply `children` to customize the hint text.
|
|
|
|
|
|
Hint for the help dialog. Supply `children` to customize the hint text.
|
|
|
|
|
|
+### LiveCollaborationTrigger
|
|
|
+
|
|
|
+If you implement live collaboration support and want to expose the same UI button as on excalidraw.com, you can render the `<LiveCollaborationTrigger>` component using the [renderTopRightUI](#rendertoprightui) prop. You'll need to supply `onSelect()` to handle opening of your collaboration dialog, but the button will display current `appState.collaborators` count for you.
|
|
|
+
|
|
|
+| Prop | Type | Required | Default | Description |
|
|
|
+| --- | --- | --- | --- | --- |
|
|
|
+| `onSelect` | `() => any` | Yes | | Handler called when the user click on the button |
|
|
|
+| `isCollaborating` | `boolean` | Yes | false | Whether live collaboration session is in effect. Modifies button style. |
|
|
|
+
|
|
|
+**Usage**
|
|
|
+
|
|
|
+```jsx
|
|
|
+import { LiveCollaborationTrigger } from "@excalidraw/excalidraw";
|
|
|
+const App = () => (
|
|
|
+ <Excalidraw
|
|
|
+ renderTopRightUI={(isMobile) => {
|
|
|
+ if (isMobile) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ <LiveCollaborationTrigger
|
|
|
+ isCollaborating={isCollaborating}
|
|
|
+ onSelect={() => setCollabDialogShown(true)}
|
|
|
+ />
|
|
|
+ );
|
|
|
+ }}
|
|
|
+ />
|
|
|
+);
|
|
|
+```
|
|
|
+
|
|
|
### Props
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
@@ -726,7 +753,6 @@ Hint for the help dialog. Supply `children` to customize the hint text.
|
|
|
| [`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) | <code>{elements?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L106">ExcalidrawElement[]</a>, appState?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L79">AppState<a> } </code> | null | The initial data with which app loads. |
|
|
|
| [`ref`](#ref) | [`createRef`](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) | [`useRef`](https://reactjs.org/docs/hooks-reference.html#useref) | [`callbackRef`](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) | <code>{ current: { readyPromise: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317">resolvablePromise</a> } }</code> | | Ref to be passed to Excalidraw |
|
|
|
-| [`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 |
|
|
|
| [`onPointerUpdate`](#onPointerUpdate) | Function | | Callback triggered when mouse pointer is updated. |
|
|
|
| [`langCode`](#langCode) | string | `en` | Language code string |
|
|
@@ -900,10 +926,6 @@ You can use this function to update the library. It accepts the below attributes
|
|
|
|
|
|
Adds supplied files data to the `appState.files` cache on top of existing files present in the cache.
|
|
|
|
|
|
-#### `onCollabButtonClick`
|
|
|
-
|
|
|
-This callback is triggered when clicked on the collab button in excalidraw. If not supplied, the collab dialog button is not rendered.
|
|
|
-
|
|
|
#### `isCollaborating`
|
|
|
|
|
|
This prop indicates if the app is in collaboration mode.
|