-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
List all the font families and font sizes from all the theme.json origins in the font picker #51488
Conversation
Size Change: +100 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me 👍
Flaky tests detected in bac3d72. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5277901909
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds good to me, too. I take it it's okay that a user wouldn't be able to remove a font family set by the theme?
A couple of other quick thoughts:
- In
useHasFontFamilyControl
it currently checks if the first found font family by origin is empty. If thecustom
array is empty, and the theme array isn't, then with this PR, it sounds like it should returntrue
. Would it be worth updating that function to use the same.concat()
logic? - When concatenated, should the lists of fonts be sorted in any particular way? Currently it looks like they'll be sorted by origin, which might be unexpected depending on the circumstances.
Code-wise this approach otherwise looks good to me, but I didn't manage to get it working for me locally with a custom
key added to the fontFamilies
in the revisions entry in the database. It's highly likely that I made a mistake in my testing... do you have a set of steps to follow for testing that this is working as expected?
Since Riad has already approved, don't feel like you need to wait for me before merging, though! 🙂
Yes, the user will be able to remove a font family defined by the theme by removing it from the array. We don't have the UI for that yet but it will be available in the font library.
Good catch! I added the same logic to
Yes! Thanks for pointing this out. I added sorting base on the font family name if it's defined or the slug in case the name is missing.
You should just add some valid theme.json containing font families to the global styles post in the database.
|
Ooops... auto-merge was activated, and when tests passed, it merged. Please report if you find something weird. |
No worries! Thanks for the extra info and updates, the code change looks good to me 🙂 |
What?
List all the font families from all the theme.json origins in the font picker
Why?
Currently, the font family picker is listing only font families from custom theme.json origin (global styles) if it's defined.
How?
Concat all the font families available from all the origins.
Testing Instructions
settings.typography.fontFamilies
in the custom global styles. (The theme.json is stored in the database)Fixes: #51487