diff --git a/src/data/transform.ts b/src/data/transform.ts index 648a4db0b1..95d0b21095 100644 --- a/src/data/transform.ts +++ b/src/data/transform.ts @@ -32,6 +32,7 @@ import { ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, + FileId, FontFamilyValues, TextAlign, VerticalAlign, @@ -154,6 +155,7 @@ export type ExcalidrawProgrammaticElement = type: Extract; x: number; y: number; + fileId: FileId; } & Partial); export interface ExcalidrawProgrammaticAPI { diff --git a/src/packages/excalidraw/example/App.tsx b/src/packages/excalidraw/example/App.tsx index 212dc1be9d..edcb4fdc12 100644 --- a/src/packages/excalidraw/example/App.tsx +++ b/src/packages/excalidraw/example/App.tsx @@ -31,7 +31,6 @@ import { ImportedLibraryData } from "../../../data/types"; import CustomFooter from "./CustomFooter"; import MobileFooter from "./MobileFooter"; import { KEYS } from "../../../keys"; -import { convertToExcalidrawElements } from "../../../data/transform"; declare global { interface Window { @@ -76,6 +75,7 @@ const { WelcomeScreen, MainMenu, LiveCollaborationTrigger, + convertToExcalidrawElements, } = window.ExcalidrawLib; const COMMENT_ICON_DIMENSION = 32; diff --git a/src/packages/excalidraw/example/initialData.tsx b/src/packages/excalidraw/example/initialData.tsx index 8f1870de4c..9feb947100 100644 --- a/src/packages/excalidraw/example/initialData.tsx +++ b/src/packages/excalidraw/example/initialData.tsx @@ -32,8 +32,8 @@ const elements: ExcalidrawProgrammaticAPI["elements"] = [ type: "image", x: 606.1042326312408, y: 153.57729779411773, - width: 231.30325348751828, - height: 231.64340533088227, + width: 230, + height: 230, fileId: "rocket" as FileId, }, ]; diff --git a/src/packages/excalidraw/index.tsx b/src/packages/excalidraw/index.tsx index 8ee2956bb6..fc677e6f7f 100644 --- a/src/packages/excalidraw/index.tsx +++ b/src/packages/excalidraw/index.tsx @@ -249,3 +249,4 @@ export { LiveCollaborationTrigger }; export { DefaultSidebar } from "../../components/DefaultSidebar"; export { normalizeLink } from "../../data/url"; +export { convertToExcalidrawElements } from "../../data/transform";