diff --git a/src/data/transform.ts b/src/data/transform.ts index 2d257525b4..ce0f63eb71 100644 --- a/src/data/transform.ts +++ b/src/data/transform.ts @@ -362,6 +362,8 @@ export const convertToExcalidrawElements = ( excalidrawElement = { width: metrics.width, height: metrics.height, + fontFamily, + fontSize, ...elementWithid, }; diff --git a/src/data/types.ts b/src/data/types.ts index a4c463f381..3e6599fa27 100644 --- a/src/data/types.ts +++ b/src/data/types.ts @@ -46,9 +46,10 @@ export interface ImportedDataState { source?: string; elements?: | readonly ( + | ExcalidrawElement | ({ - type: Exclude; - id?: ExcalidrawElement["id"]; + type: Exclude; + id?: ExcalidrawGenericElement["id"]; label?: { text: string; fontSize?: number; @@ -60,6 +61,8 @@ export interface ImportedDataState { | ({ type: "text"; text: string; + x: number; + y: number; id?: ExcalidrawTextElement["id"]; } & Partial) | ({ diff --git a/src/packages/excalidraw/example/App.tsx b/src/packages/excalidraw/example/App.tsx index 20c99d8e1b..decd47fef7 100644 --- a/src/packages/excalidraw/example/App.tsx +++ b/src/packages/excalidraw/example/App.tsx @@ -212,6 +212,12 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) { start: { type: "rectangle", id: "rect-1" }, end: { type: "ellipse" }, }, + { + type: "text", + x: 300, + y: 100, + text: "HELLO WORLD!", + }, ], null, ),