-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media & Text: Provide a way to transform into both image & paragraph #16516
Comments
I agree this makes sense as a transformation. To me, this feels like it may not need design but just be something happens? @youknowriad looping you in to see if this doesn't need design as much as can be done in transforming? |
I think it makes sense too. I know we had limitations due to InnerBlocks not available in transforms at some point but this might be solved now. |
What if the Media & Text block consisted of an nested image and paragraph blocks. If one wanted to separate them one could drag the image or paragraph out from the nested area to become full single blocks. |
While this is technically possible, "Transforms To" doesn't support wildcard transformations. It will require a unique menu item when the The wildcard support for "Transforms To" can be a nice addition to the new This is a simplified example where I used {
type: 'block',
blocks: [ 'core/paragraph' ], // No menu items is displayed when using `*`.
isMatch: ( { mediaType, mediaUrl } ) => {
return ! mediaUrl || mediaType === 'image';
},
transform: (
{ mediaAlt, mediaId, mediaUrl, anchor },
innerBlocks
) => {
return [
createBlock( 'core/image', {
alt: mediaAlt,
id: mediaId,
url: mediaUrl,
anchor,
} ),
...innerBlocks,
];
},
} |
Sometimes when I'm trying out different layouts in a page, I'll try out a media & text block, and then realize it might just be better as an image and a paragraph underneath. You can transform media & text into an image, but not into an image and a paragraph. In order to make a paragraph, you need to copy and paste the text from the media & text block into a new paragraph block, then transform the block
Likewise, it would be great to be able to do the opposite — highlight and image and paragraph block, and transform into a media & text block.
The text was updated successfully, but these errors were encountered: