Skip to content

@fabwcie/free-drawing / utils/foreignDrawing

utils/foreignDrawing ​

Functions ​

fromExcalidraw() ​

fromExcalidraw(data, frameName): DrawingFile

Defined in: packages/free-drawing/src/utils/foreignDrawing.ts:389

Drawing file of an Excalidraw drawing (.excalidraw): its elements as shapes of the library, in frames and groups, arrows linked to their shapes, texts in their shapes, images with their files, background color

Parameters

data

ForeignObject

Content of the file (type: 'excalidraw')

frameName

string

Name of a frame without name

Returns

DrawingFile

Drawing file


fromOtherApp() ​

fromOtherApp(json, frameName): string

Defined in: packages/free-drawing/src/utils/foreignDrawing.ts:937

Drawing file (JSON) of a file of the library, or of another app: Excalidraw (.excalidraw), tldraw (.tldr)

Parameters

json

string

Content of the file

frameName

string

Name of a frame without name

Returns

string

JSON of a drawing file of the library, the content itself for other contents (checked when read)

Throws

drawing of another app that can't be read


fromTldraw() ​

fromTldraw(data, frameName): DrawingFile

Defined in: packages/free-drawing/src/utils/foreignDrawing.ts:919

Drawing file of a tldraw drawing (.tldr): the shapes of its first page as shapes of the library, in frames and groups, arrows linked to their shapes, texts in their shapes, images with their files (data URLs only)

Parameters

data

ForeignObject

Content of the file (tldrawFileFormatVersion, records)

frameName

string

Name of a frame without name

Returns

DrawingFile

Drawing file