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

Allow disabling custom font size; fixes #9168 #10620

Merged

Conversation

chrisvanpatten
Copy link
Contributor

@chrisvanpatten chrisvanpatten commented Oct 15, 2018

Fixes #9168.

This introduces a new option to disable setting custom font sizes via add_theme_support('disable-custom-font-sizes');, mirroring the option in add_theme_support('disable-custom-colors');.

This provides greater control for developers over the editor experience.

When set, the numeric input will be hidden:

edit_page_ tomodomo _wordpress

@chrisvanpatten chrisvanpatten added [Type] Enhancement A suggestion for improvement. Customization Issues related to Phase 2: Customization efforts labels Oct 15, 2018
@chrisvanpatten chrisvanpatten requested review from a team, mtias and youknowriad October 15, 2018 16:30
@chrisvanpatten
Copy link
Contributor Author

I have another PR I'm working on this morning that depends on this, so I'm keen to get this merged today if possible ❤️

Copy link
Member

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think this makes sense and the code seems good (an E2E test ensuring the controls don't appear when the editor/theme disables them this would be really good though), but I have a concern: what happens when a user switches from a theme that supports custom fonts to one that doesn't? I guess things'll break because the theme didn't accommodate them?

If that's okay then 🚢, but I'm not sure.

@chrisvanpatten
Copy link
Contributor Author

chrisvanpatten commented Oct 17, 2018

@tofumatt it actually doesn't break — your custom font size is preserved, unless you explicitly change it… once you change it to a pre-defined option, you can't go back to custom (unless you close without saving).

That's because all we're doing here is hiding UI, not actually changing how the block is validated. I think this is the correct move; it's safer and prevents data loss.

@tofumatt
Copy link
Member

That answers sounds like :shipit: 🙂

@tofumatt tofumatt added this to the 4.1 - UI freeze milestone Oct 17, 2018
@chrisvanpatten chrisvanpatten merged commit 8f205dc into WordPress:master Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customization Issues related to Phase 2: Customization efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants