-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] Block Style VariationsIssues or PRs that are related to the style variations for blocksIssues or PRs that are related to the style variations for blocks[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
You can set what block style is applied (or already selected) when opening a block for first time in the editor.
New Default block styles can be set through register_block_style when is_default parameter set to true;
When registering a block style and setting it to default, the registered block style (blue quote in the example) is not set as the default; the default style included in Gutenberg is still selected.
Step-by-step reproduction instructions
- Include this code snippet in your active theme's functions.php
if ( function_exists( 'register_block_style' ) ) {
register_block_style(
'core/quote',
array(
'name' => 'blue-quote',
'label' => __( 'Blue Quote', 'textdomain' ),
'is_default' => true,
'inline_style' => '.wp-block-quote.is-style-blue-quote { color: blue; }',
)
);
}
- create a new page/post
- add block containing the block style.
Screenshots, screen recording, code snippet
screen recording shows what I describe.
https://user-images.githubusercontent.com/955351/154548693-caf94e52-d847-4f4a-95de-5b424b499edb.mp4
Environment info
- wordpress 5.9;
- gutenberg 12.6; twentynineteen theme.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
patrickdorival, AlkoKod, hallsop, lorenzrabs, DamChtlv and 4 more
Metadata
Metadata
Assignees
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] Block Style VariationsIssues or PRs that are related to the style variations for blocksIssues or PRs that are related to the style variations for blocks[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended