WordPress / create-block-theme

A WordPress plugin to create block themes
https://wordpress.org/plugins/create-block-theme/
GNU General Public License v2.0
310 stars 44 forks source link

Add image credits to the 'Edit Metadata' editor modal. #615

Closed matiasbenedetto closed 1 month ago

matiasbenedetto commented 2 months ago

What?

The deprecated admin page has a field to add image credits to the theme readme.txt file.

image

The site editor modal 'Edit Metadata' doesn't have it.

Screenshot from 2024-05-03 17-08-56

Expected

It seems like the Image credits field should be added to the modal.

t-hamano commented 1 month ago

I made a simple mockup, what do you think? You can check the branch on metadata-image-credits and the code on e9ac753.

https://github.com/WordPress/create-block-theme/assets/54422211/f94764b0-e4b0-4201-890d-9994d48683c9

This mockup has separated the title, license type, and source URL into separate fields, but there may be two problems:

Is it simply better to use a textarea?

matiasbenedetto commented 1 month ago

The mockup looks good and could be useful for creating new themes. Still, it adds an extra parsing complexity in case we want to load the existing readme.txt info from existing themes into the 'edit metadata' modal (https://github.com/WordPress/create-block-theme/issues/631), which I think could be a nice follow-up of https://github.com/WordPress/create-block-theme/pull/626.

It's not likely that all the themes with image credits have image credits in a uniform format, making it easy to parse to identify 'title,' 'license', and 'source URL' elements. Maybe we can this UI when the content of Image Credits is parsed as expected and and use the textarea as a fallback in cases where the content cannot be parsed.

pbking commented 1 month ago

Is it simply better to use a textarea?

Yes, I think that it would be better to just use a textarea. As @matiasbenedetto mentioned there's no way to know that the format of existing image credits are in. Better to just give users a block to edit.