Browse Source

fix: hide collab button when onCollabButtonClick not supplied (#2598)

David Luzar 4 years ago
parent
commit
98c26642d0

+ 1 - 0
src/packages/excalidraw/CHANGELOG.MD

@@ -26,6 +26,7 @@ Please add the latest change on the top under the correct section.
 
 ### Fixes
 
+- Hide collab button when onCollabButtonClick not supplied [#2598](https://github.com/excalidraw/excalidraw/pull/2598)
 - Fix resizing the pasted charts [#2586](https://github.com/excalidraw/excalidraw/pull/2586)
 - Fix element visibility and zoom on cursor when canvas offset isn't 0. [#2534](https://github.com/excalidraw/excalidraw/pull/2534)
 - Fix Library Menu Layout [#2502](https://github.com/excalidraw/excalidraw/pull/2502)

+ 5 - 5
src/packages/excalidraw/README.md

@@ -219,8 +219,8 @@ This is the user name which shows during collaboration. Defaults to `{name: ''}`
 
 #### `excalidrawRef`
 
-You can pass a ref when you want to access some excalidraw API's.
-We expose the below API's
+You can pass a `ref` when you want to access some excalidraw APIs.
+We expose the below APIs:
 
 | API                              | signature                                                                                                                                                                | Usage                                                                                                                                                                                                                                            |
 | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -241,15 +241,15 @@ const excalidrawRef = { current: { readyPromise: <a href="https://github.com/exc
 
 #### `onCollabButtonClick`
 
-This callback is triggered when clicked on the collab button in excalidraw
+This callback is triggered when clicked on the collab button in excalidraw. If not supplied, the collab dialog button is not rendered.
 
 #### `isCollaborating`
 
-This props implies if the app is in collaboration mode
+This prop indicates if the app is in collaboration mode.
 
 #### `onPointerUpdate`
 
-This callback is triggered when mouse pointer is updated
+This callback is triggered when mouse pointer is updated.
 
 ```js
 ({ x, y }, button, pointersMap}) => void;

+ 1 - 2
src/packages/excalidraw/index.tsx

@@ -8,7 +8,6 @@ import "../../css/styles.scss";
 
 import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
 import { IsMobileProvider } from "../../is-mobile";
-import { noop } from "../../utils";
 
 const Excalidraw = (props: ExcalidrawProps) => {
   const {
@@ -20,7 +19,7 @@ const Excalidraw = (props: ExcalidrawProps) => {
     initialData,
     user,
     excalidrawRef,
-    onCollabButtonClick = noop,
+    onCollabButtonClick,
     isCollaborating,
     onPointerUpdate,
   } = props;

+ 0 - 2
src/utils.ts

@@ -310,8 +310,6 @@ export const isTransparent = (color: string) => {
   );
 };
 
-export const noop = () => ({});
-
 export type ResolvablePromise<T> = Promise<T> & {
   resolve: [T] extends [undefined] ? (value?: T) => void : (value: T) => void;
   reject: (error: Error) => void;