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

Enable generating of descriptive text when inserting by URL. #389

Open
1 task done
peterwilsoncc opened this issue Jan 2, 2023 · 1 comment
Open
1 task done
Assignees

Comments

@peterwilsoncc
Copy link
Contributor

Is your enhancement related to a problem? Please describe.

WordPress allows for image tags to be inserted by URL, the purpose of this is to allow users to insert an image hosted elsewhere (for example on wiki-commons).

If image processing is enabled to add alt/descriptive text, it's not currently possible to ask the bot to generate the text for a remotely hosted image.

In the block editor, it would be handly to be able to do so -- either for all images or remotely hosted images only.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Sidsector9 Sidsector9 self-assigned this Jan 29, 2023
@Sidsector9 Sidsector9 moved this from Incoming to In Progress in Open Source Practice Jan 29, 2023
@Sidsector9
Copy link
Member

@peterwilsoncc I've tried several approaches on this but couldn't come up with a solution.

The URL in the image block is not stored in block attributes. Instead, when the URL is entered, an image element is immediately generated with the URL added to its src HTML attribute. So it stores the HTML in the database.

I tried extracting the block data using parse_blocks and manipulating the attributes using DOM parsers, but couldn't serialise the block again as the HTML was generated client-side.


Additionally, adding/updating the URL to the core/image block doesn't emit any events either, that we could add a callback to. Do you have any suggestions to this?

@jeffpaul jeffpaul added this to the Future Release milestone Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

3 participants