Skip to content

API > @blocksuite/blocks > withTempBlobData

Function: withTempBlobData ​

withTempBlobData(): object

Because the image block and attachment block have different props. We need to save some data temporarily when converting between them to ensure no data is lost.

For example, before converting from an image block to an attachment block, we need to save the image's width and height.

Similarly, when converting from an attachment block to an image block, we need to save the attachment's name.

See also https://github.com/toeverything/blocksuite/pull/4583#pullrequestreview-1610662677

Returns ​

getAttachmentData ​

getAttachmentData: function

Parameters ​

ParameterType
blockIdstring

Returns ​

undefined | {name: string;}

getImageData ​

getImageData: function

Parameters ​

ParameterType
blockIdstring

Returns ​

undefined | {height: undefined | number; width: undefined | number;}

saveAttachmentData ​

saveAttachmentData: function

Parameters ​

ParameterType
sourceIdstring
dataobject
data.namestring

Returns ​

void

saveImageData ​

saveImageData: function

Parameters ​

ParameterType
sourceIdstring
dataobject
data.heightundefined | number
data.widthundefined | number

Returns ​

void

Defined In ​

packages/blocks/src/_common/utils/filesys.ts:283