theme.json needs "fontSize" and "fontFamily" properties in settings>typography to allow disabling of the controls while keeping the CSS #50330
Labels
Developer Experience
Ideas about improving block and theme developer experience
[Feature] Design Tools
Tools that impact the appearance of blocks both to expand the number of tools and improve the experi
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
This issue arises when programmatically changing editor settings via block_editor_settings_all filter.
Lets assume we want to only allow admins to be able to change text color by using themes palette. We can do this by creating a palette in
settings>color>palette
and settingsettings>color>text
totrue
. Then, we can filter the editor settings by hooking toblock_editor_settings_all
and changingsettings>color>text
tofalse
for non-admin users. Works great, however, we can not do the same for font size or font family controls because the only way to enable/disable these controls in the editor is by having an array set insettings>typography>fontSizes/fontFamilies
. If the only way to remove the control from the editor is by removing the array then the CSS will not be generated for the front end.What is your proposed solution?
Add a setting similar to
settings>color>text
tosettings->typography
. Maybe call these settingfontSize
andfontFamily
. With these new settings we can keep the frontend CSS that is generated from the arrays but be able to programmatically control if a user should see the controls in the editor.The text was updated successfully, but these errors were encountered: