WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.42k stars 4.16k forks source link

Convert image caption to inner block #54787

Open cbirdsong opened 1 year ago

cbirdsong commented 1 year ago

Right now, the image caption is part of the image block. It would be nice if the caption was a specialized inner block similar to list items so that it could have block styles registered on it. This might also make it easier to address https://github.com/WordPress/gutenberg/issues/19975.

Edit: It looks like this was already tried in a PR, but that PR has no associated issue.

aaronrobertshaw commented 1 year ago

There is a closed issue (https://github.com/WordPress/gutenberg/issues/28920) relating to potentially converting an image block's caption to an inner block.

The possibility was also discussed on several of the PRs refactoring the Gallery block to use inner image blocks. There didn't seem to be much appetite for the change. Since then, caption element styling has been added to global styles which might reduce the potential need for the inner block as well.

Relating to the text alignment for image captions in https://github.com/WordPress/gutenberg/issues/19975, there is also some further discussion on https://github.com/WordPress/gutenberg/issues/12997.

creativecoder commented 9 months ago

I came across this while working with a user this week--they were looking for a way to style image and video captions and couldn't find one.

mrfoxtalbot commented 4 months ago

Noting that this has already been explored:

paaljoachim commented 1 month ago

Do anyone have any thoughts on how to move this issue onward?

I believe it will be very helpful to use inner blocks for the Image caption. The issue was originally made back in 2018 here: https://github.com/WordPress/gutenberg/issues/12997

simison commented 1 month ago

Related, if captions are inner blocks, it would be easier to add an "attribution" block as well: