Add option for themes to configure block styles#16532
Add option for themes to configure block styles#16532jorgefilipecosta wants to merge 2 commits intomasterfrom
Conversation
80d96cb to
a97655c
Compare
|
Can I suggest naming it |
3635719 to
5261961
Compare
|
Hi @chrisvanpatten, your suggestion was applied. |
lib/client-assets.php
Outdated
| function gutenberg_add_auto_apply_block_styles_setting( $settings ) { | ||
| $auto_apply_styles = current( (array) get_theme_support( 'editor-default-block-styles' ) ); | ||
| if ( false !== $auto_apply_styles ) { | ||
| $settings['themeAutoApplyStyles'] = $auto_apply_styles; |
There was a problem hiding this comment.
Not sure if it's too late to rename that but I think we should be consistent with naming between __experimentalPreferredBlockStyles editor-default-block-styles and themeAutoApplyStyles .
Maybe __experimentalPreferredBlockStyles, editor-preferred-block-styles and preferredBlockStyles
There was a problem hiding this comment.
Hi @youknowriad your suggestion was applied 👍
5261961 to
42200b5
Compare
42200b5 to
adf918a
Compare
| * @return array Filtered editor settings. | ||
| */ | ||
| function gutenberg_add_preferred_block_styles_setting( $settings ) { | ||
| $preferred_block_styles = current( (array) get_theme_support( 'editor-preferred-block-styles' ) ); |
There was a problem hiding this comment.
Any reason for everything else being experimental and not this: editor-preferred-block-styles
There was a problem hiding this comment.
The reason was that while I expected editor-preferred-block-styles to be the way themes set the default styles, I was not totally confident in the way we pass the settings to the block editor. We have the user preference and the theme preference, we pass a single default (join of both settings). Depending on the UI we may need to pass the user value and the theme value (e.g: if we want to show the default if the user resets its setting). As the block styles UI, did not receive much attention I thought it would be good to keep the options open.
But we can make editor-preferred-block-styles experimental, or stabilize the javascript settings given that an additional time passed and until now we did not face problems. Any thoughts on this?
There was a problem hiding this comment.
The reason was that while I expected editor-preferred-block-styles to be the way themes set the default styles
Do you think the global styles work (theme.json) or the block-features proposal could change that too?
|
Closing this PR until we defined a way to offer something equivalent with global styles. |
Description
Depends on: #16465
This PR extends the work done in #16465 . to allow themes to set the default styles applied to a block.
How has this been tested?
I went to functions.php of the currently enabled theme.
I pasted the following code:
I created a new quote and a new pullquote I verified the default styles were large and solid color respectively.