diff --git a/src/clipboard.ts b/src/clipboard.ts index c0deb93af2..7ac9478f26 100644 --- a/src/clipboard.ts +++ b/src/clipboard.ts @@ -11,6 +11,7 @@ import { deepCopyElement } from "./element/newElement"; import { mutateElement } from "./element/mutateElement"; import { getContainingFrame } from "./frame"; import { isPromiseLike, isTestEnv } from "./utils"; +import { ExcalidrawProgrammaticElement } from "./data/transform"; type ElementsClipboard = { type: typeof EXPORT_DATA_TYPES.excalidrawClipboard; @@ -20,7 +21,7 @@ type ElementsClipboard = { export interface ClipboardData { spreadsheet?: Spreadsheet; - elements?: readonly ExcalidrawElement[]; + elements?: readonly (ExcalidrawElement | ExcalidrawProgrammaticElement)[]; files?: BinaryFiles; text?: string; errorMessage?: string; diff --git a/src/components/App.tsx b/src/components/App.tsx index 0e02a9ee7c..277c4c46bf 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1928,9 +1928,12 @@ class App extends React.Component { }, }); } else if (data.elements) { - const elements = data.programmaticAPI - ? convertToExcalidrawElements(data.elements) - : data.elements; + const elements = ( + data.programmaticAPI + ? //@ts-ignore + convertToExcalidrawElements(data.elements) + : data.elements + ) as readonly ExcalidrawElement[]; // TODO remove formatting from elements if isPlainPaste this.addElementsFromPasteOrLibrary({ elements,