-
Hello 👋 First of all, Thanks a lot for Gutenberg and this awesome editor. So, I had a custom block, which had this as <summary {...blockProps} >
<InnerBlocks.Content />
</details> And that is now return <RichText.Content {...blockProps} tagName="summary" value={attributes.content}/> and with a new attribute in const attributes = {
content: {
"type": "string",
"source": 'html',
"selector": 'summary'
}
} I'm now trying to create the deprecation of the old save. Do you have an idea? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's a good question. I don't think there's a reliable way to do this. The problem is that The amount of data loss really depends on the makeup of your inner blocks in the old version of your block. If the block was completely freeform and any block was allowed to be added as an inner block, then it becomes a bit tricky. Your best bet is to use If you had |
Beta Was this translation helpful? Give feedback.
That's a good question. I don't think there's a reliable way to do this. The problem is that
RichText
is naturally less capable thanInnerBlocks
, so you won't be able to reliably convert from inner blocks to rich text without some data loss.The amount of data loss really depends on the makeup of your inner blocks in the old version of your block.
If the block was completely freeform and any block was allowed to be added as an inner block, then it becomes a bit tricky. Your best bet is to use
migrate
in the deprecation. You get access to the inner blocks as the second param to that function. Your challenge will be to assemble those inner blocks into acontent
string. You could probably st…