瀏覽代碼

fix: remove image preview on image insertion (#9626)

Co-authored-by: dwelle <[email protected]>
Marcel Mraz 3 月之前
父節點
當前提交
a7b64f02b3

+ 2 - 8
dev-docs/docs/@excalidraw/excalidraw/api/props/excalidraw-api.mdx

@@ -363,13 +363,7 @@ This API has the below signature. It sets the `tool` passed in param as the acti
 ```ts
 (
   tool: (
-    | (
-        | { type: Exclude<ToolType, "image"> }
-        | {
-            type: Extract<ToolType, "image">;
-            insertOnCanvasDirectly?: boolean;
-          }
-      )
+    | { type: ToolType }
     | { type: "custom"; customType: string }
   ) & { locked?: boolean },
 ) => {};
@@ -377,7 +371,7 @@ This API has the below signature. It sets the `tool` passed in param as the acti
 
 | Name | Type | Default | Description |
 | --- | --- | --- | --- |
-| `type` | [ToolType](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L91) | `selection` | The tool type which should be set as active tool. When setting `image` as active tool, the insertion onto canvas when using image tool is disabled by default, so you can enable it by setting `insertOnCanvasDirectly` to `true` |
+| `type` | [ToolType](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/types.ts#L91) | `selection` | The tool type which should be set as active tool |
 | `locked` | `boolean` | `false` | Indicates whether the the active tool should be locked. It behaves the same way when using the `lock` tool in the editor interface |
 
 ## setCursor

+ 10 - 4
packages/element/src/delta.ts

@@ -694,14 +694,20 @@ export class AppStateDelta implements DeltaContainer<AppState> {
             break;
           case "croppingElementId": {
             const croppingElementId = nextAppState[key];
-            const element =
-              croppingElementId && nextElements.get(croppingElementId);
 
-            if (element && !element.isDeleted) {
+            if (!croppingElementId) {
+              // previously there was a croppingElementId (assuming visible), now there is none
               visibleDifferenceFlag.value = true;
             } else {
-              nextAppState[key] = null;
+              const element = nextElements.get(croppingElementId);
+
+              if (element && !element.isDeleted) {
+                visibleDifferenceFlag.value = true;
+              } else {
+                nextAppState[key] = null;
+              }
             }
+
             break;
           }
           case "editingGroupId":

+ 0 - 13
packages/excalidraw/actions/actionFinalize.tsx

@@ -122,18 +122,6 @@ export const actionFinalize = register({
 
     let newElements = elements;
 
-    const pendingImageElement =
-      appState.pendingImageElementId &&
-      scene.getElement(appState.pendingImageElementId);
-
-    if (pendingImageElement) {
-      scene.mutateElement(
-        pendingImageElement,
-        { isDeleted: true },
-        { informMutation: false, isDragging: false },
-      );
-    }
-
     if (window.document.activeElement instanceof HTMLElement) {
       focusContainer();
     }
@@ -280,7 +268,6 @@ export const actionFinalize = register({
           element && isLinearElement(element)
             ? new LinearElementEditor(element, arrayToMap(newElements))
             : appState.selectedLinearElement,
-        pendingImageElementId: null,
       },
       // TODO: #7348 we should not capture everything, but if we don't, it leads to incosistencies -> revisit
       captureUpdate: CaptureUpdateAction.IMMEDIATELY,

+ 0 - 2
packages/excalidraw/appState.ts

@@ -109,7 +109,6 @@ export const getDefaultAppState = (): Omit<
       value: 1 as NormalizedZoomValue,
     },
     viewModeEnabled: false,
-    pendingImageElementId: null,
     showHyperlinkPopup: false,
     selectedLinearElement: null,
     snapLines: [],
@@ -238,7 +237,6 @@ const APP_STATE_STORAGE_CONF = (<
   zenModeEnabled: { browser: true, export: false, server: false },
   zoom: { browser: true, export: false, server: false },
   viewModeEnabled: { browser: false, export: false, server: false },
-  pendingImageElementId: { browser: false, export: false, server: false },
   showHyperlinkPopup: { browser: false, export: false, server: false },
   selectedLinearElement: { browser: true, export: false, server: false },
   snapLines: { browser: false, export: false, server: false },

+ 0 - 1
packages/excalidraw/components/Actions.tsx

@@ -352,7 +352,6 @@ export const ShapesSwitcher = ({
               if (value === "image") {
                 app.setActiveTool({
                   type: value,
-                  insertOnCanvasDirectly: pointerType !== "mouse",
                 });
               } else {
                 app.setActiveTool({ type: value });

+ 23 - 157
packages/excalidraw/components/App.tsx

@@ -161,7 +161,6 @@ import {
   maybeParseEmbedSrc,
   getEmbedLink,
   getInitializedImageElements,
-  loadHTMLImageElement,
   normalizeSVG,
   updateImageCache as _updateImageCache,
   getBoundTextElement,
@@ -258,7 +257,6 @@ import type {
   ExcalidrawEmbeddableElement,
   Ordered,
   MagicGenerationData,
-  ExcalidrawNonSelectionElement,
   ExcalidrawArrowElement,
   ExcalidrawElbowArrowElement,
 } from "@excalidraw/element/types";
@@ -338,7 +336,6 @@ import {
 } from "../scene";
 import { getStateForZoom } from "../scene/zoom";
 import {
-  dataURLToFile,
   dataURLToString,
   generateIdFromFile,
   getDataURL,
@@ -440,7 +437,6 @@ import type {
   AppProps,
   AppState,
   BinaryFileData,
-  DataURL,
   ExcalidrawImperativeAPI,
   BinaryFiles,
   Gesture,
@@ -1520,7 +1516,6 @@ class App extends React.Component<AppProps, AppState> {
         width: this.state.width,
         editingTextElement: this.state.editingTextElement,
         newElementId: this.state.newElement?.id,
-        pendingImageElementId: this.state.pendingImageElementId,
       });
     this.visibleElements = visibleElements;
 
@@ -4711,16 +4706,10 @@ class App extends React.Component<AppProps, AppState> {
   };
 
   setActiveTool = (
-    tool: (
-      | (
-          | { type: Exclude<ToolType, "image"> }
-          | {
-              type: Extract<ToolType, "image">;
-              insertOnCanvasDirectly?: boolean;
-            }
-        )
-      | { type: "custom"; customType: string }
-    ) & { locked?: boolean; fromSelection?: boolean },
+    tool: ({ type: ToolType } | { type: "custom"; customType: string }) & {
+      locked?: boolean;
+      fromSelection?: boolean;
+    },
     keepSelection = false,
   ) => {
     if (!this.isToolSupported(tool.type)) {
@@ -4746,10 +4735,7 @@ class App extends React.Component<AppProps, AppState> {
       this.setState({ suggestedBindings: [] });
     }
     if (nextActiveTool.type === "image") {
-      this.onImageAction({
-        insertOnCanvasDirectly:
-          (tool.type === "image" && tool.insertOnCanvasDirectly) ?? false,
-      });
+      this.onImageAction();
     }
 
     this.setState((prevState) => {
@@ -6595,34 +6581,6 @@ class App extends React.Component<AppProps, AppState> {
         this.state.activeTool.type,
         pointerDownState,
       );
-    } else if (this.state.activeTool.type === "image") {
-      // reset image preview on pointerdown
-      setCursor(this.interactiveCanvas, CURSOR_TYPE.CROSSHAIR);
-
-      // retrieve the latest element as the state may be stale
-      const pendingImageElement =
-        this.state.pendingImageElementId &&
-        this.scene.getElement(this.state.pendingImageElementId);
-
-      if (!pendingImageElement) {
-        return;
-      }
-
-      this.setState({
-        newElement: pendingImageElement as ExcalidrawNonSelectionElement,
-        pendingImageElementId: null,
-        multiElement: null,
-      });
-
-      const { x, y } = viewportCoordsToSceneCoords(event, this.state);
-
-      const frame = this.getTopLayerFrameAtSceneCoords({ x, y });
-
-      this.scene.mutateElement(pendingImageElement, {
-        x,
-        y,
-        frameId: frame ? frame.id : null,
-      });
     } else if (this.state.activeTool.type === "freedraw") {
       this.handleFreeDrawElementOnPointerDown(
         event,
@@ -6646,7 +6604,8 @@ class App extends React.Component<AppProps, AppState> {
       );
     } else if (
       this.state.activeTool.type !== "eraser" &&
-      this.state.activeTool.type !== "hand"
+      this.state.activeTool.type !== "hand" &&
+      this.state.activeTool.type !== "image"
     ) {
       this.createGenericElementOnPointerDown(
         this.state.activeTool.type,
@@ -9092,10 +9051,6 @@ class App extends React.Component<AppProps, AppState> {
         pointerDownState.eventListeners.onKeyUp!,
       );
 
-      if (this.state.pendingImageElementId) {
-        this.setState({ pendingImageElementId: null });
-      }
-
       this.props?.onPointerUp?.(activeTool, pointerDownState);
       this.onPointerUpEmitter.trigger(
         this.state.activeTool,
@@ -9873,11 +9828,9 @@ class App extends React.Component<AppProps, AppState> {
   private initializeImage = async ({
     imageFile,
     imageElement: _imageElement,
-    showCursorImagePreview = false,
   }: {
     imageFile: File;
     imageElement: ExcalidrawImageElement;
-    showCursorImagePreview?: boolean;
   }) => {
     // at this point this should be guaranteed image file, but we do this check
     // to satisfy TS down the line
@@ -9935,16 +9888,6 @@ class App extends React.Component<AppProps, AppState> {
       }
     }
 
-    if (showCursorImagePreview) {
-      const dataURL = this.files[fileId]?.dataURL;
-      // optimization so that we don't unnecessarily resize the original
-      // full-size file for cursor preview
-      // (it's much faster to convert the resized dataURL to File)
-      const resizedFile = dataURL && dataURLToFile(dataURL);
-
-      this.setImagePreviewCursor(resizedFile || imageFile);
-    }
-
     const dataURL =
       this.files[fileId]?.dataURL || (await getDataURL(imageFile));
 
@@ -9983,11 +9926,7 @@ class App extends React.Component<AppProps, AppState> {
 
           const imageHTML = await cachedImageData?.image;
 
-          if (
-            imageHTML &&
-            this.state.pendingImageElementId !== imageElement.id &&
-            this.state.newElement?.id !== imageElement.id
-          ) {
+          if (imageHTML && this.state.newElement?.id !== imageElement.id) {
             const naturalDimensions = this.getImageNaturalDimensions(
               imageElement,
               imageHTML,
@@ -10000,10 +9939,6 @@ class App extends React.Component<AppProps, AppState> {
         } catch (error: any) {
           console.error(error);
           reject(new Error(t("errors.imageInsertError")));
-        } finally {
-          if (!showCursorImagePreview) {
-            resetCursor(this.interactiveCanvas);
-          }
         }
       },
     );
@@ -10015,7 +9950,6 @@ class App extends React.Component<AppProps, AppState> {
   insertImageElement = async (
     imageElement: ExcalidrawImageElement,
     imageFile: File,
-    showCursorImagePreview?: boolean,
   ) => {
     // we should be handling all cases upstream, but in case we forget to handle
     // a future case, let's throw here
@@ -10030,7 +9964,6 @@ class App extends React.Component<AppProps, AppState> {
       const image = await this.initializeImage({
         imageFile,
         imageElement,
-        showCursorImagePreview,
       });
 
       const nextElements = this.scene
@@ -10063,58 +9996,7 @@ class App extends React.Component<AppProps, AppState> {
     }
   };
 
-  private setImagePreviewCursor = async (imageFile: File) => {
-    // mustn't be larger than 128 px
-    // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Basic_User_Interface/Using_URL_values_for_the_cursor_property
-    const cursorImageSizePx = 96;
-    let imagePreview;
-
-    try {
-      imagePreview = await resizeImageFile(imageFile, {
-        maxWidthOrHeight: cursorImageSizePx,
-      });
-    } catch (e: any) {
-      if (e.cause === "UNSUPPORTED") {
-        throw new Error(t("errors.unsupportedFileType"));
-      }
-      throw e;
-    }
-
-    let previewDataURL = await getDataURL(imagePreview);
-
-    // SVG cannot be resized via `resizeImageFile` so we resize by rendering to
-    // a small canvas
-    if (imageFile.type === MIME_TYPES.svg) {
-      const img = await loadHTMLImageElement(previewDataURL);
-
-      let height = Math.min(img.height, cursorImageSizePx);
-      let width = height * (img.width / img.height);
-
-      if (width > cursorImageSizePx) {
-        width = cursorImageSizePx;
-        height = width * (img.height / img.width);
-      }
-
-      const canvas = document.createElement("canvas");
-      canvas.height = height;
-      canvas.width = width;
-      const context = canvas.getContext("2d")!;
-
-      context.drawImage(img, 0, 0, width, height);
-
-      previewDataURL = canvas.toDataURL(MIME_TYPES.svg) as DataURL;
-    }
-
-    if (this.state.pendingImageElementId) {
-      setCursor(this.interactiveCanvas, `url(${previewDataURL}) 4 4, auto`);
-    }
-  };
-
-  private onImageAction = async ({
-    insertOnCanvasDirectly,
-  }: {
-    insertOnCanvasDirectly: boolean;
-  }) => {
+  private onImageAction = async () => {
     try {
       const clientX = this.state.width / 2 + this.state.offsetLeft;
       const clientY = this.state.height / 2 + this.state.offsetTop;
@@ -10137,35 +10019,20 @@ class App extends React.Component<AppProps, AppState> {
         addToFrameUnderCursor: false,
       });
 
-      if (insertOnCanvasDirectly) {
-        this.insertImageElement(imageElement, imageFile);
-        this.initializeImageDimensions(imageElement);
-        this.store.scheduleCapture();
-        this.setState(
-          {
-            selectedElementIds: makeNextSelectedElementIds(
-              { [imageElement.id]: true },
-              this.state,
-            ),
-          },
-          () => {
-            this.actionManager.executeAction(actionFinalize);
-          },
-        );
-      } else {
-        this.setState(
-          {
-            pendingImageElementId: imageElement.id,
-          },
-          () => {
-            this.insertImageElement(
-              imageElement,
-              imageFile,
-              /* showCursorImagePreview */ true,
-            );
-          },
-        );
-      }
+      this.insertImageElement(imageElement, imageFile);
+      this.initializeImageDimensions(imageElement);
+      this.store.scheduleCapture();
+      this.setState(
+        {
+          selectedElementIds: makeNextSelectedElementIds(
+            { [imageElement.id]: true },
+            this.state,
+          ),
+        },
+        () => {
+          this.actionManager.executeAction(actionFinalize);
+        },
+      );
     } catch (error: any) {
       if (error.name !== "AbortError") {
         console.error(error);
@@ -10174,7 +10041,6 @@ class App extends React.Component<AppProps, AppState> {
       }
       this.setState(
         {
-          pendingImageElementId: null,
           newElement: null,
           activeTool: updateActiveTool(this.state, { type: "selection" }),
         },

+ 0 - 1
packages/excalidraw/components/CommandPalette/CommandPalette.tsx

@@ -503,7 +503,6 @@ function CommandPaletteInner({
               if (value === "image") {
                 app.setActiveTool({
                   type: value,
-                  insertOnCanvasDirectly: event.type === EVENT.KEYDOWN,
                 });
               } else {
                 app.setActiveTool({ type: value });

+ 0 - 4
packages/excalidraw/components/HintViewer.tsx

@@ -74,10 +74,6 @@ const getHints = ({
     return t("hints.embeddable");
   }
 
-  if (appState.activeTool.type === "image" && appState.pendingImageElementId) {
-    return t("hints.placeImage");
-  }
-
   const selectedElements = app.scene.getSelectedElements(appState);
 
   if (

+ 0 - 1
packages/excalidraw/components/canvases/InteractiveCanvas.tsx

@@ -198,7 +198,6 @@ const getRelevantAppStateProps = (
   offsetLeft: appState.offsetLeft,
   offsetTop: appState.offsetTop,
   theme: appState.theme,
-  pendingImageElementId: appState.pendingImageElementId,
   selectionElement: appState.selectionElement,
   selectedGroupIds: appState.selectedGroupIds,
   selectedLinearElement: appState.selectedLinearElement,

+ 0 - 1
packages/excalidraw/components/canvases/StaticCanvas.tsx

@@ -100,7 +100,6 @@ const getRelevantAppStateProps = (appState: AppState): StaticCanvasAppState => {
     offsetLeft: appState.offsetLeft,
     offsetTop: appState.offsetTop,
     theme: appState.theme,
-    pendingImageElementId: appState.pendingImageElementId,
     shouldCacheIgnoreZoom: appState.shouldCacheIgnoreZoom,
     viewBackgroundColor: appState.viewBackgroundColor,
     exportScale: appState.exportScale,

+ 0 - 1
packages/excalidraw/locales/en.json

@@ -347,7 +347,6 @@
     "lineEditor_line_info": "Double-click or press Enter to edit points",
     "lineEditor_pointSelected": "Press Delete to remove point(s),\nCtrlOrCmd+D to duplicate, or drag to move",
     "lineEditor_nothingSelected": "Select a point to edit (hold SHIFT to select multiple),\nor hold Alt and click to add new points",
-    "placeImage": "Click to place the image, or click and drag to set its size manually",
     "publishLibrary": "Publish your own library",
     "bindTextToElement": "Press enter to add text",
     "createFlowchart": "Hold CtrlOrCmd and Arrow key to create a flowchart",

+ 0 - 15
packages/excalidraw/scene/Renderer.ts

@@ -1,5 +1,4 @@
 import { isElementInViewport } from "@excalidraw/element";
-import { isImageElement } from "@excalidraw/element";
 
 import { memoize, toBrandedType } from "@excalidraw/common";
 
@@ -72,25 +71,14 @@ export class Renderer {
       elements,
       editingTextElement,
       newElementId,
-      pendingImageElementId,
     }: {
       elements: readonly NonDeletedExcalidrawElement[];
       editingTextElement: AppState["editingTextElement"];
       newElementId: ExcalidrawElement["id"] | undefined;
-      pendingImageElementId: AppState["pendingImageElementId"];
     }) => {
       const elementsMap = toBrandedType<RenderableElementsMap>(new Map());
 
       for (const element of elements) {
-        if (isImageElement(element)) {
-          if (
-            // => not placed on canvas yet (but in elements array)
-            pendingImageElementId === element.id
-          ) {
-            continue;
-          }
-        }
-
         if (newElementId === element.id) {
           continue;
         }
@@ -119,7 +107,6 @@ export class Renderer {
         width,
         editingTextElement,
         newElementId,
-        pendingImageElementId,
         // cache-invalidation nonce
         sceneNonce: _sceneNonce,
       }: {
@@ -134,7 +121,6 @@ export class Renderer {
         /** note: first render of newElement will always bust the cache
          * (we'd have to prefilter elements outside of this function) */
         newElementId: ExcalidrawElement["id"] | undefined;
-        pendingImageElementId: AppState["pendingImageElementId"];
         sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
       }) => {
         const elements = this.scene.getNonDeletedElements();
@@ -143,7 +129,6 @@ export class Renderer {
           elements,
           editingTextElement,
           newElementId,
-          pendingImageElementId,
         });
 
         const visibleElements = getVisibleCanvasElements({

+ 0 - 17
packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap

@@ -957,7 +957,6 @@ exports[`contextMenu element > right-clicking on a group should select whole gro
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1153,7 +1152,6 @@ exports[`contextMenu element > selecting 'Add to library' in context menu adds e
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1367,7 +1365,6 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1698,7 +1695,6 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2029,7 +2025,6 @@ exports[`contextMenu element > selecting 'Copy styles' in context menu copies st
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2243,7 +2238,6 @@ exports[`contextMenu element > selecting 'Delete' in context menu deletes elemen
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2484,7 +2478,6 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2782,7 +2775,6 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id3": true,
   },
@@ -3154,7 +3146,6 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3647,7 +3638,6 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3970,7 +3960,6 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -4293,7 +4282,6 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id3": true,
   },
@@ -5578,7 +5566,6 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -6795,7 +6782,6 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -7733,7 +7719,6 @@ exports[`contextMenu element > shows context menu for canvas > [end of test] app
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8730,7 +8715,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9724,7 +9708,6 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,

+ 0 - 62
packages/excalidraw/tests/__snapshots__/history.test.tsx.snap

@@ -79,7 +79,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id4": true,
   },
@@ -692,7 +691,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id4": true,
   },
@@ -1178,7 +1176,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1542,7 +1539,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1909,7 +1905,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2169,7 +2164,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2611,7 +2605,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2873,7 +2866,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3139,7 +3131,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3433,7 +3424,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3719,7 +3709,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3954,7 +3943,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -4211,7 +4199,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -4482,7 +4469,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -4711,7 +4697,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -4940,7 +4925,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -5167,7 +5151,6 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -5394,7 +5377,6 @@ exports[`history > multiplayer undo/redo > conflicts in frames and their childre
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -5647,7 +5629,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id1": true,
   },
@@ -5909,7 +5890,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id8": true,
   },
@@ -6272,7 +6252,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id1": true,
   },
@@ -6649,7 +6628,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -6958,7 +6936,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -7261,7 +7238,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -7459,7 +7435,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -7811,7 +7786,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8163,7 +8137,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -8569,7 +8542,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8856,7 +8828,6 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9120,7 +9091,6 @@ exports[`history > multiplayer undo/redo > should not override remote changes on
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9385,7 +9355,6 @@ exports[`history > multiplayer undo/redo > should not override remote changes on
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9620,7 +9589,6 @@ exports[`history > multiplayer undo/redo > should override remotely added groups
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9914,7 +9882,6 @@ exports[`history > multiplayer undo/redo > should override remotely added points
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -10260,7 +10227,6 @@ exports[`history > multiplayer undo/redo > should redistribute deltas when eleme
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -10488,7 +10454,6 @@ exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end o
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -10933,7 +10898,6 @@ exports[`history > multiplayer undo/redo > should update history entries after r
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -11193,7 +11157,6 @@ exports[`history > singleplayer undo/redo > remounting undo/redo buttons should
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -11428,7 +11391,6 @@ exports[`history > singleplayer undo/redo > should clear the redo stack on eleme
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -11665,7 +11627,6 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -12071,7 +12032,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on e
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -12281,7 +12241,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on e
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -12491,7 +12450,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on i
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -12715,7 +12673,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on i
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -12939,7 +12896,6 @@ exports[`history > singleplayer undo/redo > should create new history entry on s
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": -50,
@@ -13181,7 +13137,6 @@ exports[`history > singleplayer undo/redo > should disable undo/redo buttons whe
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -13418,7 +13373,6 @@ exports[`history > singleplayer undo/redo > should end up with no history entry
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -13655,7 +13609,6 @@ exports[`history > singleplayer undo/redo > should iterate through the history w
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -13902,7 +13855,6 @@ exports[`history > singleplayer undo/redo > should not clear the redo stack on s
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -14236,7 +14188,6 @@ exports[`history > singleplayer undo/redo > should not collapse when applying co
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -14403,7 +14354,6 @@ exports[`history > singleplayer undo/redo > should not end up with history entry
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -14690,7 +14640,6 @@ exports[`history > singleplayer undo/redo > should not end up with history entry
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -14950,7 +14899,6 @@ exports[`history > singleplayer undo/redo > should not override appstate changes
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -15235,7 +15183,6 @@ exports[`history > singleplayer undo/redo > should support appstate name or view
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -15394,7 +15341,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -16093,7 +16039,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -16725,7 +16670,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -17357,7 +17301,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -18070,7 +18013,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -18815,7 +18757,6 @@ exports[`history > singleplayer undo/redo > should support changes in elements'
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -19295,7 +19236,6 @@ exports[`history > singleplayer undo/redo > should support duplication of groups
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id1": true,
   },
@@ -19806,7 +19746,6 @@ exports[`history > singleplayer undo/redo > should support element creation, del
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id3": true,
   },
@@ -20265,7 +20204,6 @@ exports[`history > singleplayer undo/redo > should support linear element creati
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },

+ 0 - 52
packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap

@@ -80,7 +80,6 @@ exports[`given element A and group of elements B and given both are selected whe
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -506,7 +505,6 @@ exports[`given element A and group of elements B and given both are selected whe
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -922,7 +920,6 @@ exports[`regression tests > Cmd/Ctrl-click exclusively select element under poin
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1488,7 +1485,6 @@ exports[`regression tests > Drags selected element when hitting only bounding bo
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -1695,7 +1691,6 @@ exports[`regression tests > adjusts z order when grouping > [end of test] appSta
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -2079,7 +2074,6 @@ exports[`regression tests > alt-drag duplicates an element > [end of test] appSt
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -2324,7 +2318,6 @@ exports[`regression tests > arrow keys > [end of test] appState 1`] = `
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -2504,7 +2497,6 @@ exports[`regression tests > can drag element that covers another element, while
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id6": true,
   },
@@ -2829,7 +2821,6 @@ exports[`regression tests > change the properties of a shape > [end of test] app
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -3084,7 +3075,6 @@ exports[`regression tests > click on an element and drag it > [dragged] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -3325,7 +3315,6 @@ exports[`regression tests > click on an element and drag it > [end of test] appS
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -3561,7 +3550,6 @@ exports[`regression tests > click to select a shape > [end of test] appState 1`]
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id3": true,
   },
@@ -3819,7 +3807,6 @@ exports[`regression tests > click-drag to select a group > [end of test] appStat
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id6": true,
   },
@@ -4133,7 +4120,6 @@ exports[`regression tests > deleting last but one element in editing group shoul
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -4569,7 +4555,6 @@ exports[`regression tests > deselects group of selected elements on pointer down
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -4852,7 +4837,6 @@ exports[`regression tests > deselects group of selected elements on pointer up w
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -5128,7 +5112,6 @@ exports[`regression tests > deselects selected element on pointer down when poin
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -5336,7 +5319,6 @@ exports[`regression tests > deselects selected element, on pointer up, when clic
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -5536,7 +5518,6 @@ exports[`regression tests > double click to edit a group > [end of test] appStat
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -5929,7 +5910,6 @@ exports[`regression tests > drags selected elements from point inside common bou
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -6226,7 +6206,6 @@ exports[`regression tests > draw every type of shape > [end of test] appState 1`
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -7058,7 +7037,6 @@ exports[`regression tests > given a group of selected elements with an element t
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id6": true,
@@ -7392,7 +7370,6 @@ exports[`regression tests > given a selected element A and a not selected elemen
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -7671,7 +7648,6 @@ exports[`regression tests > given selected element A with lower z-index than uns
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -7906,7 +7882,6 @@ exports[`regression tests > given selected element A with lower z-index than uns
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -8146,7 +8121,6 @@ exports[`regression tests > key 2 selects rectangle tool > [end of test] appStat
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8326,7 +8300,6 @@ exports[`regression tests > key 3 selects diamond tool > [end of test] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8506,7 +8479,6 @@ exports[`regression tests > key 4 selects ellipse tool > [end of test] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8686,7 +8658,6 @@ exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1`
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -8912,7 +8883,6 @@ exports[`regression tests > key 6 selects line tool > [end of test] appState 1`]
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9136,7 +9106,6 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9332,7 +9301,6 @@ exports[`regression tests > key a selects arrow tool > [end of test] appState 1`
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9558,7 +9526,6 @@ exports[`regression tests > key d selects diamond tool > [end of test] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9738,7 +9705,6 @@ exports[`regression tests > key l selects line tool > [end of test] appState 1`]
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -9962,7 +9928,6 @@ exports[`regression tests > key o selects ellipse tool > [end of test] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -10142,7 +10107,6 @@ exports[`regression tests > key p selects freedraw tool > [end of test] appState
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -10338,7 +10302,6 @@ exports[`regression tests > key r selects rectangle tool > [end of test] appStat
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -10518,7 +10481,6 @@ exports[`regression tests > make a group and duplicate it > [end of test] appSta
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -11049,7 +11011,6 @@ exports[`regression tests > noop interaction after undo shouldn't create history
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -11329,7 +11290,6 @@ exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = `
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": "-6.25000",
@@ -11452,7 +11412,6 @@ exports[`regression tests > shift click on selected element should deselect it o
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -11652,7 +11611,6 @@ exports[`regression tests > shift-click to multiselect, then drag > [end of test
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -11971,7 +11929,6 @@ exports[`regression tests > should group elements and ungroup them > [end of tes
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id3": true,
@@ -12400,7 +12357,6 @@ exports[`regression tests > single-clicking on a subgroup of a selected group sh
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
     "id15": true,
@@ -13043,7 +12999,6 @@ exports[`regression tests > spacebar + drag scrolls the canvas > [end of test] a
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 60,
@@ -13166,7 +13121,6 @@ exports[`regression tests > supports nested groups > [end of test] appState 1`]
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id0": true,
   },
@@ -13797,7 +13751,6 @@ exports[`regression tests > switches from group of selected elements to another
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id3": true,
     "id6": true,
@@ -14136,7 +14089,6 @@ exports[`regression tests > switches selected element on pointer down > [end of
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {
     "id3": true,
   },
@@ -14400,7 +14352,6 @@ exports[`regression tests > two-finger scroll works > [end of test] appState 1`]
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 20,
@@ -14523,7 +14474,6 @@ exports[`regression tests > undo/redo drawing an element > [end of test] appStat
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -14912,7 +14862,6 @@ exports[`regression tests > updates fontSize & fontFamily appState > [end of tes
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,
@@ -15038,7 +14987,6 @@ exports[`regression tests > zoom hotkeys > [end of test] appState 1`] = `
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,

+ 0 - 4
packages/excalidraw/types.ts

@@ -24,7 +24,6 @@ import type {
   ChartType,
   FontFamilyValues,
   FileId,
-  ExcalidrawImageElement,
   Theme,
   StrokeRoundness,
   ExcalidrawEmbeddableElement,
@@ -191,7 +190,6 @@ type _CommonCanvasAppState = {
   offsetLeft: AppState["offsetLeft"];
   offsetTop: AppState["offsetTop"];
   theme: AppState["theme"];
-  pendingImageElementId: AppState["pendingImageElementId"];
 };
 
 export type StaticCanvasAppState = Readonly<
@@ -416,8 +414,6 @@ export interface AppState {
         shown: true;
         data: Spreadsheet;
       };
-  /** imageElement waiting to be placed on canvas */
-  pendingImageElementId: ExcalidrawImageElement["id"] | null;
   showHyperlinkPopup: false | "info" | "editor";
   selectedLinearElement: LinearElementEditor | null;
   snapLines: readonly SnapLine[];

+ 0 - 1
packages/utils/tests/__snapshots__/export.test.ts.snap

@@ -81,7 +81,6 @@ exports[`exportToSvg > with default arguments 1`] = `
   },
   "penDetected": false,
   "penMode": false,
-  "pendingImageElementId": null,
   "previousSelectedElementIds": {},
   "resizingElement": null,
   "scrollX": 0,