debug preview fix

This commit is contained in:
Ryan Di 2024-12-05 16:02:04 +08:00
parent 113dfc0023
commit 7762b925ae

View File

@ -79,7 +79,10 @@ import {
} from "./components/ExportToExcalidrawPlus";
import { updateStaleImageStatuses } from "./data/FileManager";
import { newElementWith } from "../packages/excalidraw/element/mutateElement";
import { isInitializedImageElement } from "../packages/excalidraw/element/typeChecks";
import {
isInitializedImageElement,
isRectangularElement,
} from "../packages/excalidraw/element/typeChecks";
import { loadFilesFromFirebase } from "./data/firebase";
import {
LibraryIndexedDBAdapter,
@ -641,16 +644,15 @@ const ExcalidrawWrapper = () => {
collabAPI.syncElements(elements);
}
{
const frame = elements.find(
(el) => el.strokeStyle === "dashed" && !el.isDeleted,
const nonDeletedElements = getNonDeletedElements(elements);
const frame = nonDeletedElements.find(
(el) => el.strokeStyle === "dashed" && el.type === "rectangle",
);
exportToCanvas({
data: {
elements: getNonDeletedElements(elements).filter(
(x) => x.id !== frame?.id,
),
elements: nonDeletedElements.filter((x) => x.id !== frame?.id),
// .concat(
// restoreElements(
// [
@ -723,7 +725,6 @@ const ExcalidrawWrapper = () => {
// canvas.style.width = "100%";
}
});
}
// this check is redundant, but since this is a hot path, it's best
// not to evaludate the nested expression every time