[MOOSE-324] Paragraph Block Class Name #299
Merged
+64
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this do/fix?
Note that this was a filter previously introduced & removed from Moose. WP at some point was supporting paragraph blocks having the
wp-block-paragraphclass, but no longer are, so we need to add this support so some of our related styling can also function as intended.This pull request introduces a new filter to ensure that the
core/paragraphblock always includes its default CSS class name, improving styling consistency. The implementation uses a reusable trait to add the class name, and registers the new filter in the block definitions.New Paragraph Block Filter:
Added a new
Paragraph_Filterclass that ensures thecore/paragraphblock always includes its default CSS class by using a shared trait. (wp-content/plugins/core/src/Blocks/Filters/Paragraph_Filter.php)Registered the new
Paragraph_Filterin the block filters array, so it is applied automatically. (wp-content/plugins/core/src/Blocks/Blocks_Definer.php) [1] [2]Reusable Trait for Adding Default Class Name:
Add_Block_Default_Class_Nametrait, which adds thewp-block-<block name>CSS class to blocks that do not render it by default. This serves as a polyfill until WordPress core provides this functionality. (wp-content/plugins/core/src/Blocks/Filters/Traits/Add_Block_Default_Class_Name.php)QA
Links to relevant issues