-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Preserve caption when converting Image Block to Media & Text Block #22478
Comments
Hey @eyesofjeremy! Thanks for reporting this. For anyone looking into this, I was able to replicate this experience using Gutenberg 8.1.0 and WordPress 5.4.1 with the Twenty Twenty theme. As for the issue itself, I imagine part of the trouble here is that what one wants as the caption vs as the text in the Media & Text block will likely be different. For example, I might make my caption say "picture of me at the fair" but want that separated out from the Text portion where I might write a more long form description of my experience at the fair. With that said, I think you're right that the current experience feels like a loss of productivity potentially if someone wrote a caption for an image then converted the block. On the flip side, there are use cases where someone might have uploaded a few images, added captions, and then went to use the Media & Text block only to get annoyed that the captions were included in the text portion. Tagging design folks in here to see what ideas they might have :) |
The same thing happens when transforming Image block to Cover block, the caption is lost. While the use case might be different between Cover, Image and Media & Text, perhaps the caption can be preserved in the text section in other blocks and vice versa. |
Thanks @annezazu! I can imagine some cases where someone is not going to want the captions carried over from an image block to a Media & Text block, but it seems like a very minor inconvenience compared with losing content. But you bring up a good point — should the Media & Text also have a spot for a caption? Could be part of the block's Settings sidebar. @yunjuc good point. @annezazu can you also label this issue w/ "[Feature] Block Conversion"? This seems appropriate. FWIW there's a comment on Issue 11473 which mentions this destructive transformation. Maybe this is just part of the larger discussion on how to handle conversion between blocks. |
@eyesofjeremy updated with that label - great thinking! I agree that this does seem to be tied into a larger conversation but it's important to see detailed issues like this to help bring the problem to life. |
See also #14604 |
Since this requires #14604, I think we can close the issue. If/when caption support is implemented for the Media & Text block, it will be retained during transformation. |
The Problem
When converting an Image Block to a Media & Text block, a previously-written caption gets lost.
A Solution?
The Media & Text block seems to have a semantically similar structure to the Image Block — there is an image, and a section of text. When converting from Image Block to Media & Text, it would be great if any image caption gets converted into a paragraph text block.
What about switching back?
If switching from an image block preserves the caption, then logically switching to an Image Block from Media & Text should also preserve content. But suddenly it's more complicated, as the Media & Text could have headings and multiple paragraphs. Right now, that's also lost in a switch.
Since the Image caption is not designed to contain multiple blocks of content, perhaps the different blocks could be converted to plain text separated by a single space upon conversion. Or even a double space, which might not last when saving, but could help an editor switch back if they would like to.
This might not be ideal, but seems far better than losing ALL content. And in the case of a simple one-paragraph caption, one gets to switch back and forth without real loss of productivity.
Alternatives
If the image caption were saved with the media upon switching, then it would be available upon switching back. But this seems more complex, and less intuitive, than keeping the content visible to the editor during a switch.
The text was updated successfully, but these errors were encountered: