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

This commit is contained in:
David Luzar 2020-12-15 16:21:14 +01:00 committed by GitHub
parent 2b434db062
commit 98c26642d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -26,6 +26,7 @@ Please add the latest change on the top under the correct section.
### Fixes ### 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 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 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) - Fix Library Menu Layout [#2502](https://github.com/excalidraw/excalidraw/pull/2502)

View File

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

View File

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

View File

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