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

Ability to filter image caption #7363

Open
kallehauge opened this issue Jun 19, 2018 · 6 comments
Open

Ability to filter image caption #7363

kallehauge opened this issue Jun 19, 2018 · 6 comments
Labels
[Block] Image Affects the Image Block [Feature] Extensibility The ability to extend blocks or the editing experience [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Enhancement A suggestion for improvement.

Comments

@kallehauge
Copy link
Contributor

kallehauge commented Jun 19, 2018

Is your feature request related to a problem? Please describe.
I would like to be able to alter the caption text on the initial insert of an image (default image block), like it is possible with ex image_add_caption_text in the classic WYSIWYG editor.

(I guess this could be expanded to alter things like alt attribute text etc as well?)

Describe the solution you'd like
I would like a filter or some sort of option to alter and/or override the caption text.
The way it works right now with Gutenberg, if I understand it correctly, then the Media window is loaded with the image and their metadata "on demand" and if one or multiple images are selected then they will get injected directly into the editor, so there is no place to change this before insertion. So the only potential option would be to change the values already when the window is opened but this surely seems like a bad workaround.

What would be really ideal from a plugin/theme developers perspective would be to get access to the data here:

return ! mediaObject.caption ?

@mtias mtias added the [Feature] Extensibility The ability to extend blocks or the editing experience label Jul 19, 2018
@draganescu
Copy link
Contributor

@youknowriad this issue has been added to the Extensibility project which I see you've closed. Should we remove issues that are still relevant from closed projects?

@youknowriad
Copy link
Contributor

Yes, we can remove the project assignment, it's not that important though. Other closed project assignments might be important to keep track of though (other than Extensibilty)

@paaljoachim paaljoachim added [Block] Image Affects the Image Block [Type] Enhancement A suggestion for improvement. labels Feb 16, 2021
@mtias mtias added the [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later label Feb 23, 2021
@vreemt
Copy link

vreemt commented Jan 20, 2023

it might be good to add this to #28923 and possibly get a progress update please & thank you

@jordesign
Copy link
Contributor

@kallehauge Does the fact that the caption tool is available in the toolbar resolve this for you? Or is this still something to keep in mind?

Screenshot 2023-07-13 at 4 01 11 pm

@kallehauge
Copy link
Contributor Author

Uh! It's been a while @jordesign, but I believe I had a few different instances where dynamically defining the caption during insert made sense (there might be different workarounds for some of them, now).

  • I believe one of them was translation related, so if different translations was stored as metadata on the attachment, it wasn't possible to change the string that's being used.
  • Another instance I vaguely remember is inserting copyright information (either the attachment owner or a metadata value).

TL;DR: I believe it's still as valid for the same use-cases that the older classic editor image_add_caption_text filter satisfies (automating work for the editor and allowing 3. parties to generally modify the value)

@jordesign
Copy link
Contributor

Thanks for checking in @kallehauge - given all that it makes sense to leave it open for now 👍

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 [Feature] Extensibility The ability to extend blocks or the editing experience [Priority] Low Used to indicate that the issue at hand isn't a top priority to address and can be handled later [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

7 participants