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