Skip to content
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

Open
eyesofjeremy opened this issue May 19, 2020 · 5 comments
Open
Labels
[Block] Image Affects the Image Block [Block] Media & Text Affects the Media & Text Block [Feature] Block Transforms Block transforms from one block to another Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Comments

@eyesofjeremy
Copy link

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.

@annezazu annezazu added [Block] Image Affects the Image Block [Block] Media & Text Affects the Media & Text Block [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. labels May 20, 2020
@annezazu
Copy link
Contributor

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 :)

@yunjuc
Copy link

yunjuc commented May 21, 2020

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.

@eyesofjeremy
Copy link
Author

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.

@annezazu annezazu added the [Feature] Block Transforms Block transforms from one block to another label May 26, 2020
@annezazu
Copy link
Contributor

@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.

@ellatrix
Copy link
Member

See also #14604

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Block] Media & Text Affects the Media & Text Block [Feature] Block Transforms Block transforms from one block to another Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants