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 ​
Parameter | Type |
---|---|
blockId | string |
Returns ​
undefined
| {name
: string
;}
getImageData
​
getImageData:
function
Parameters ​
Parameter | Type |
---|---|
blockId | string |
Returns ​
undefined
| {height
: undefined
| number
; width
: undefined
| number
;}
saveAttachmentData
​
saveAttachmentData:
function
Parameters ​
Parameter | Type |
---|---|
sourceId | string |
data | object |
data.name | string |
Returns ​
void
saveImageData
​
saveImageData:
function
Parameters ​
Parameter | Type |
---|---|
sourceId | string |
data | object |
data.height | undefined | number |
data.width | undefined | number |
Returns ​
void
Defined In ​
packages/blocks/src/_common/utils/filesys.ts:283