fix: remove image preview on image insertion (#9626)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user