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