-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
[Block] Post ContentAffects the Post Content BlockAffects the Post Content Block[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
I've registered a custom block style variation for the core/post-content block using a JSON file located at:
[theme]/styles/blocks/post-content-red-headings.json
{
"$schema": "https://raw.githubusercontent.com/WordPress/gutenberg/trunk/schemas/json/theme.json",
"version": 3,
"title": "Post content in red headings",
"slug": "red-headings",
"blockTypes": [ "core/post-content" ],
"description": "Post content with red headings.",
"styles": {
"elements": {
"heading": {
"color": {
"text": "#ff0000"
}
}
}
}
}When this style variation is applied to the core/post-content block within the page.html template, it renders correctly on the frontend. However, in the Site Editor, the styles are not applied unless the "Show template" option is enabled.
Expected Behavior:
The styles defined in the block style variation JSON should be applied in the Site Editor regardless of the "Show template" setting.
Actual Behavior:
The styles are only applied in the Site Editor when "Show template" is enabled.
Step-by-step reproduction instructions
- Create the above JSON file in the specified directory.
- Add
<!-- wp:post-content {"className":"is-style-red-headings"} /-->to thepage.htmltemplate. - Open a page and add some headings to the content
- Observe that the custom styles are not applied in the editor.
- Enable the "Show template" option.
- Observe that the custom styles are now applied.
Screenshots, screen recording, code snippet
WordPress.Playground.mp4
Environment info
No response
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
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
karthikeya-iokushagra-goyal-14
Metadata
Metadata
Assignees
Labels
[Block] Post ContentAffects the Post Content BlockAffects the Post Content Block[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