refactor: Fix Typo (#7445)

This commit is contained in:
Adithyan 2023-12-16 23:53:11 +05:30 committed by GitHub
parent 537f6e7f68
commit 7bd6496854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 15 deletions

View File

@ -439,7 +439,7 @@ ExcalidrawAppStateContext.displayName = "ExcalidrawAppStateContext";
const ExcalidrawSetAppStateContext = React.createContext< const ExcalidrawSetAppStateContext = React.createContext<
React.Component<any, AppState>["setState"] React.Component<any, AppState>["setState"]
>(() => { >(() => {
console.warn("unitialized ExcalidrawSetAppStateContext context!"); console.warn("Uninitialized ExcalidrawSetAppStateContext context!");
}); });
ExcalidrawSetAppStateContext.displayName = "ExcalidrawSetAppStateContext"; ExcalidrawSetAppStateContext.displayName = "ExcalidrawSetAppStateContext";
@ -2867,7 +2867,6 @@ class App extends React.Component<AppProps, AppState> {
// event else some browsers (FF...) will clear the clipboardData // event else some browsers (FF...) will clear the clipboardData
// (something something security) // (something something security)
let file = event?.clipboardData?.files[0]; let file = event?.clipboardData?.files[0];
const data = await parseClipboard(event, isPlainPaste); const data = await parseClipboard(event, isPlainPaste);
if (!file && !isPlainPaste) { if (!file && !isPlainPaste) {
if (data.mixedContent) { if (data.mixedContent) {
@ -3370,7 +3369,7 @@ class App extends React.Component<AppProps, AppState> {
}); });
}; };
private cancelInProgresAnimation: (() => void) | null = null; private cancelInProgressAnimation: (() => void) | null = null;
scrollToContent = ( scrollToContent = (
target: target:
@ -3395,7 +3394,7 @@ class App extends React.Component<AppProps, AppState> {
duration?: number; duration?: number;
}, },
) => { ) => {
this.cancelInProgresAnimation?.(); this.cancelInProgressAnimation?.();
// convert provided target into ExcalidrawElement[] if necessary // convert provided target into ExcalidrawElement[] if necessary
const targetElements = Array.isArray(target) ? target : [target]; const targetElements = Array.isArray(target) ? target : [target];
@ -3462,9 +3461,9 @@ class App extends React.Component<AppProps, AppState> {
duration: opts?.duration ?? 500, duration: opts?.duration ?? 500,
}); });
this.cancelInProgresAnimation = () => { this.cancelInProgressAnimation = () => {
cancel(); cancel();
this.cancelInProgresAnimation = null; this.cancelInProgressAnimation = null;
}; };
} else { } else {
this.setState({ scrollX, scrollY, zoom }); this.setState({ scrollX, scrollY, zoom });
@ -3481,7 +3480,7 @@ class App extends React.Component<AppProps, AppState> {
private translateCanvas: React.Component<any, AppState>["setState"] = ( private translateCanvas: React.Component<any, AppState>["setState"] = (
state, state,
) => { ) => {
this.cancelInProgresAnimation?.(); this.cancelInProgressAnimation?.();
this.maybeUnfollowRemoteUser(); this.maybeUnfollowRemoteUser();
this.setState(state); this.setState(state);
}; };
@ -7779,7 +7778,7 @@ class App extends React.Component<AppProps, AppState> {
), ),
}; };
}); });
// if not gragging a linear element point (outside editor) // if not dragging a linear element point (outside editor)
} else if (!this.state.selectedLinearElement?.isDragging) { } else if (!this.state.selectedLinearElement?.isDragging) {
// remove element from selection while // remove element from selection while
// keeping prev elements selected // keeping prev elements selected
@ -8104,7 +8103,10 @@ class App extends React.Component<AppProps, AppState> {
maxWidthOrHeight: DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT, maxWidthOrHeight: DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
}); });
} catch (error: any) { } catch (error: any) {
console.error("error trying to resing image file on insertion", error); console.error(
"Error trying to resizing image file on insertion",
error,
);
} }
if (imageFile.size > MAX_ALLOWED_FILE_BYTES) { if (imageFile.size > MAX_ALLOWED_FILE_BYTES) {
@ -8647,7 +8649,7 @@ class App extends React.Component<AppProps, AppState> {
} }
if (file) { if (file) {
// atetmpt to parse an excalidraw/excalidrawlib file // Attempt to parse an excalidraw/excalidrawlib file
await this.loadFileToCanvas(file, fileHandle); await this.loadFileToCanvas(file, fileHandle);
} }
@ -8746,13 +8748,13 @@ class App extends React.Component<AppProps, AppState> {
}); });
const selectedElements = this.scene.getSelectedElements(this.state); const selectedElements = this.scene.getSelectedElements(this.state);
const isHittignCommonBoundBox = const isHittingCommonBoundBox =
this.isHittingCommonBoundingBoxOfSelectedElements( this.isHittingCommonBoundingBoxOfSelectedElements(
{ x, y }, { x, y },
selectedElements, selectedElements,
); );
const type = element || isHittignCommonBoundBox ? "element" : "canvas"; const type = element || isHittingCommonBoundBox ? "element" : "canvas";
const container = this.excalidrawContainerRef.current!; const container = this.excalidrawContainerRef.current!;
const { top: offsetTop, left: offsetLeft } = const { top: offsetTop, left: offsetLeft } =

View File

@ -53,7 +53,7 @@ export type Collaborator = Readonly<{
background: string; background: string;
stroke: string; stroke: string;
}; };
// The url of the collaborator's avatar, defaults to username intials // The url of the collaborator's avatar, defaults to username initials
// if not present // if not present
avatarUrl?: string; avatarUrl?: string;
// user id. If supplied, we'll filter out duplicates when rendering user avatars. // user id. If supplied, we'll filter out duplicates when rendering user avatars.
@ -500,10 +500,10 @@ export type ExportOpts = {
) => JSX.Element; ) => JSX.Element;
}; };
// NOTE at the moment, if action name coressponds to canvasAction prop, its // NOTE at the moment, if action name corresponds to canvasAction prop, its
// truthiness value will determine whether the action is rendered or not // truthiness value will determine whether the action is rendered or not
// (see manager renderAction). We also override canvasAction values in // (see manager renderAction). We also override canvasAction values in
// excalidraw package index.tsx. // Excalidraw package index.tsx.
export type CanvasActions = Partial<{ export type CanvasActions = Partial<{
changeViewBackgroundColor: boolean; changeViewBackgroundColor: boolean;
clearCanvas: boolean; clearCanvas: boolean;