Opened 8 months ago
Last modified 3 months ago
#61466 new defect (bug)
Block Bindings: Add support for image caption
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | Editor | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
Allow the block bindings API to process the image caption attribute and replace its inner content with the value obtained from the source.
There is an issue with pattern overrides caused by this: GB62287.
Additionally, it is a good enhancement.
Change History (11)
This ticket was mentioned in PR #6838 on WordPress/wordpress-develop by @santosguillamot.
8 months ago
#1
@ellatrix commented on PR #6838:
8 months ago
#2
I'm quite worried about introducing caption support this late in the release cycle. Imo it deserves some testing as a feature in the GB plugin first. I've made this alternative PR that disallows overrides for an image with caption: https://github.com/WordPress/gutenberg/pull/62747.
@santosguillamot commented on PR #6838:
8 months ago
#3
I totally understand the concerns. And I agree that if support for image caption is not added, code to disallowing overrides in images with captions for 6.6 could be a good alternative.
@santosguillamot commented on PR #6838:
7 months ago
#6
I'd prefer the name of the method be scarier, like seriously_wait_for_core_to_replace_inner_html() but that's just a personal preference.
While I agree we could change the name to prevent users even more from copying it, seriously_wait_for_core_to_replace_inner_html
seems too much to me. Here are some other options that, combined withthe warning message, I believe should be scary enough:
do_not_copy_set_figcaption_inner_html
.private_set_figcaption_inner_html
.internal_do_not_use_figcaption_inner_html
.
Apart from that, we could always wait to support the image caption until the HTML Processor provides its own method.
Any thoughts?
@cbravobernal commented on PR #6838:
7 months ago
#7
private_set_figcaption_inner_html
I would go with private_set_figcaption_inner_html
5 months ago
#8
What's the status on this? it seems reasonable at the moment, unless there are concerns still about it coming late in the cycle.
@santosguillamot commented on PR #6838:
5 months ago
#9
What's the status on this? it seems reasonable at the moment, unless there are concerns still about it coming late in the cycle.
It wasn't considered a priority, and I personally didn't find time to push it. It would probably need a small refactor and testing in Gutenberg as well: link.
Taking into account that the last Gutenberg version included in 6.7 beta will be on Sep 18th, I personally don't have the bandwidth to work on it, but I'm happy to help if needed.
#10
@
4 months ago
- Milestone changed from 6.7 to Future Release
It seems that this one still requires some work before it can be considered, so pushing to Future Release
. If I am misunderstanding the status, please feel free to clarify and move back.
@jonsurrell commented on PR #6838:
3 months ago
#11
@SantosGuillamot and I did some work on an implementation leveraging the HTML processor and using a set_inner_html
implementation in https://github.com/WordPress/wordpress-develop/pull/7742.
This pull request should be tested together with this other one from Gutenberg, because it needs changes in the image render file.
## What?
Add support for the image caption attribute in block bindings.
## Why?
There is an issue with pattern overrides caused by this: https://github.com/WordPress/gutenberg/issues/62287.
Additionally, it is a good enhancement.
## How?
I created an anonymous class to extend the tag processor and include
set_inner_text
until there is a similar method provided by default.Additionally, in Gutenberg pull request, I'm modifying the render file of the image to:
figcaption
element when it exists, and the binding value is empty.figcaption
element when it doesn't exist, and the binding value is not empty.Trac ticket: https://core.trac.wordpress.org/ticket/61466