From 83c03c55f90500c1bee7c8f649ad5a5d06e3c120 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 15:58:03 -0500 Subject: [PATCH 01/13] Force core paragraph & list blocks to render a default CSS class name. --- .../core/src/Blocks/Blocks_Subscriber.php | 8 +++ .../Filters/Add_Block_Default_Class_Name.php | 55 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php diff --git a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php index d979abe6..82eb52fd 100644 --- a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php +++ b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php @@ -3,6 +3,7 @@ namespace Tribe\Plugin\Blocks; use Tribe\Libs\Container\Abstract_Subscriber; +use Tribe\Plugin\Blocks\Filters\Add_Block_Default_Class_Name; use Tribe\Plugin\Blocks\Filters\Contracts\Filter_Factory; use Tribe\Plugin\Blocks\Patterns\Pattern_Category; use Tribe\Plugin\Blocks\Patterns\Pattern_Registrar; @@ -83,6 +84,13 @@ public function register(): void { return $filter ? $filter->filter_block_content( $block_content, $block ) : $block_content; }, 10, 2 ); + /** + * Add a default css class name to specific blocks. + */ + add_filter( 'render_block', function ( string $block_content, array $parsed_block, object $block ): string { + return $this->container->get( Add_Block_Default_Class_Name::class )->add_class_name( $block_content, $parsed_block, $block ); + }, 10, 3 ); + /** * Disable default WP block patterns. */ diff --git a/wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php b/wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php new file mode 100644 index 00000000..88ff2683 --- /dev/null +++ b/wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php @@ -0,0 +1,55 @@ +` CSS class rendered for the specific blocks mentioned above. + * + * This filter is a polyfill for core blocks that don't render their own CSS class name. + * Without the class name on the block, CSS styling becomes much more problematic. + * + * Eventually WP Core should handle this for us and we can remove this filter. + * + * Related outstanding issues in Gutenberg: + * * https://github.com/WordPress/gutenberg/pull/42269 + * * https://github.com/WordPress/gutenberg/issues/50486 + * * https://github.com/WordPress/gutenberg/pull/47282 + * + * @param string $block_content Rendered block content. + * @param array $parsed_block The block being rendered. + * @param object $block Block object. + * + * @return string Updated block content. + */ + public function add_class_name( string $block_content, array $parsed_block, object $block ): string { + if ( ! $block_content ) { + return $block_content; + } + + if ( ! $block->block_type || $block->block_type->is_dynamic() ) { + return $block_content; + } + + if ( ! in_array( $block->name, $this->blocks_to_filter ) ) { + return $block_content; + } + + $tags = new \WP_HTML_Tag_Processor( $block_content ); + if ( $tags->next_tag() ) { + $tags->add_class( wp_get_block_default_classname( $block->name ) ); + } + + return $tags->get_updated_html(); + } + +} From f4daeafadf513c8d101e38b62d9b7b8b7f06c792 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 16:12:14 -0500 Subject: [PATCH 02/13] Update list block styles to work with new block-specific selector. --- .../themes/core/blocks/core/lists/style.pcss | 77 ++++++++----------- 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/wp-content/themes/core/blocks/core/lists/style.pcss b/wp-content/themes/core/blocks/core/lists/style.pcss index 3558656d..252ce83a 100644 --- a/wp-content/themes/core/blocks/core/lists/style.pcss +++ b/wp-content/themes/core/blocks/core/lists/style.pcss @@ -2,58 +2,43 @@ * Styles specific to this block */ -/* ---------------------------------------------------------------------- - * Ordered List - * - * The first selector applies to the FE, the second in the editor. - * The list block is the only block on the FE that doesn't get a class, - * so we're able to apply a :not() selector for the class attribute. - * While both will apply in the editor, only the second will affect - * the actual list block. - * ---------------------------------------------------------------------- */ - -.wp-site-blocks ol:not([class]), -ol.wp-block-list { - padding-inline-start: 1.2rem; - - & li { - padding-inline-start: 10px; +.wp-block-list { - &::marker { - font-weight: var(--font-weight-bold); - } + li ~ li { + margin-top: var(--spacer-30); + } + + /* ---------------------------------------------------------------------- + * CASE: Ordered List + * ---------------------------------------------------------------------- */ + + ol& { + padding-inline-start: 1.2rem; + + li { + padding-inline-start: 10px; - & ~ li { - margin-top: var(--spacer-30); + &::marker { + font-weight: var(--font-weight-bold); + } } } -} -/* ---------------------------------------------------------------------- - * Unordered List - * - * The first selector applies to the FE, the second in the editor. - * The list block is the only block on the FE that doesn't get a class, - * so we're able to apply a :not() selector for the class attribute. - * While both will apply in the editor, only the second will affect - * the actual list block. - * ---------------------------------------------------------------------- */ - -.wp-site-blocks ul:not([class]), -ul.wp-block-list { - padding-inline-start: 10px; - - & li { - padding-inline-start: 1.3rem; - position: relative; - - &::marker { - content: var(--icon-list-bullet); - transform: translateX(10px); - } + /* ---------------------------------------------------------------------- + * CASE: Unordered List + * ---------------------------------------------------------------------- */ + + ul& { + padding-inline-start: 10px; + + li { + padding-inline-start: 1.3rem; + position: relative; - & ~ li { - margin-top: var(--spacer-30); + &::marker { + content: var(--icon-list-bullet); + transform: translateX(10px); + } } } } From b55517a7a719acd857277bb0bea9b7f843020c67 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 16:12:56 -0500 Subject: [PATCH 03/13] Remove unnecessary blockquote partial. --- wp-content/themes/core/assets/pcss/editor.pcss | 1 - wp-content/themes/core/assets/pcss/theme.pcss | 1 - .../core/assets/pcss/typography/blockquote.pcss | 14 -------------- 3 files changed, 16 deletions(-) delete mode 100644 wp-content/themes/core/assets/pcss/typography/blockquote.pcss diff --git a/wp-content/themes/core/assets/pcss/editor.pcss b/wp-content/themes/core/assets/pcss/editor.pcss index de0214a1..ff169d4a 100644 --- a/wp-content/themes/core/assets/pcss/editor.pcss +++ b/wp-content/themes/core/assets/pcss/editor.pcss @@ -12,7 +12,6 @@ @import "layout/default.pcss"; @import "global/reset.pcss"; @import "typography/anchors.pcss"; -@import "typography/blockquote.pcss"; /* Patterns */ @import "cards/post.pcss"; diff --git a/wp-content/themes/core/assets/pcss/theme.pcss b/wp-content/themes/core/assets/pcss/theme.pcss index 96090acd..b9b4ae5e 100644 --- a/wp-content/themes/core/assets/pcss/theme.pcss +++ b/wp-content/themes/core/assets/pcss/theme.pcss @@ -12,7 +12,6 @@ @import "global/reset.pcss"; @import "layout/default.pcss"; @import "typography/anchors.pcss"; -@import "typography/blockquote.pcss"; @import "global/stacking-order.pcss"; /* Patterns */ diff --git a/wp-content/themes/core/assets/pcss/typography/blockquote.pcss b/wp-content/themes/core/assets/pcss/typography/blockquote.pcss deleted file mode 100644 index 3f85754e..00000000 --- a/wp-content/themes/core/assets/pcss/typography/blockquote.pcss +++ /dev/null @@ -1,14 +0,0 @@ -/* ------------------------------------------------------------------------- - * - * Typography: Blockquote - * - * ------------------------------------------------------------------------- */ - -:where(.wp-site-blocks) blockquote, -.editor-styles-wrapper blockquote { - - /* Override paragraph block's theme.json default styles */ - & p { - font: inherit; - } -} From 5b811c2e39a17d34724e46ca8410cf99916341ed Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 16:13:15 -0500 Subject: [PATCH 04/13] Simplify heading selector. --- wp-content/themes/core/blocks/core/heading/style.pcss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-content/themes/core/blocks/core/heading/style.pcss b/wp-content/themes/core/blocks/core/heading/style.pcss index c26a7708..9c3faf60 100644 --- a/wp-content/themes/core/blocks/core/heading/style.pcss +++ b/wp-content/themes/core/blocks/core/heading/style.pcss @@ -2,7 +2,7 @@ * Styles specific to this block */ -:--heading:where(.wp-block-heading) { +:--heading.wp-block-heading { /* CASE: Style X-Large */ &.is-style-x-large { From cbfc33c36b44a1bc29013c89d51d06c72a5408f0 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 16:14:37 -0500 Subject: [PATCH 05/13] Simplify paragraph selector based on new block class name. --- wp-content/themes/core/blocks/core/paragraph/style.pcss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wp-content/themes/core/blocks/core/paragraph/style.pcss b/wp-content/themes/core/blocks/core/paragraph/style.pcss index 74b2acb2..86047dd7 100644 --- a/wp-content/themes/core/blocks/core/paragraph/style.pcss +++ b/wp-content/themes/core/blocks/core/paragraph/style.pcss @@ -2,8 +2,7 @@ * Styles specific to this block */ -:where(.wp-site-blocks) p, -p.wp-block-paragraph { +.wp-block-paragraph { /* CASE: Style Large */ &.is-style-large { From 7dbaaa588ac40cfda60db4b1f82efbdebbfef3c5 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 16:23:04 -0500 Subject: [PATCH 06/13] Simplify anchor selectors. --- wp-content/themes/core/assets/pcss/typography/anchors.pcss | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wp-content/themes/core/assets/pcss/typography/anchors.pcss b/wp-content/themes/core/assets/pcss/typography/anchors.pcss index 0ed30ce2..01a78d18 100644 --- a/wp-content/themes/core/assets/pcss/typography/anchors.pcss +++ b/wp-content/themes/core/assets/pcss/typography/anchors.pcss @@ -6,7 +6,7 @@ a { - :where(.wp-site-blocks) &:not(.wp-element-button):focus-visible { + .wp-block-post-content &:not(.wp-element-button):focus-visible { @mixin focus-visible-inline-text; } @@ -17,8 +17,7 @@ a { * Note: Not in theme.json as the selector needs to be more specific * ------------------------------------------------------------------------- */ - :where(.wp-site-blocks) :where(p, li) &, - .editor-styles-wrapper :where(p, li) & { + .wp-block-post-content :where(p, li) & { @mixin inline-text-link; } From 9f05ea09fe8b1561a09dc66f077ea889266014d0 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Thu, 26 Oct 2023 16:29:09 -0500 Subject: [PATCH 07/13] Remove default focus-visible styles from reset. It's bleeding into the admin & editor. --- wp-content/themes/core/assets/pcss/global/reset.pcss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-content/themes/core/assets/pcss/global/reset.pcss b/wp-content/themes/core/assets/pcss/global/reset.pcss index c2a33ee5..173743f9 100644 --- a/wp-content/themes/core/assets/pcss/global/reset.pcss +++ b/wp-content/themes/core/assets/pcss/global/reset.pcss @@ -81,7 +81,15 @@ select { margin: 0; } +/** + * TODO: Make sure this is desired. + * Right now it only appears to affect the block editor and in unintended ways. + * I *think* we want to set a global default focus-visible style, + * but it should _not_ bleed into the admin/editor. + */ +/* :where(.wp-site-blocks) *:focus-visible { @mixin focus-visible; } +*/ From 62c85819b50203c4bbfa932636f9869767c2333d Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Fri, 27 Oct 2023 09:53:18 -0500 Subject: [PATCH 08/13] Update comment. --- wp-content/themes/core/assets/pcss/global/reset.pcss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-content/themes/core/assets/pcss/global/reset.pcss b/wp-content/themes/core/assets/pcss/global/reset.pcss index 173743f9..e16ccc8b 100644 --- a/wp-content/themes/core/assets/pcss/global/reset.pcss +++ b/wp-content/themes/core/assets/pcss/global/reset.pcss @@ -83,8 +83,8 @@ select { /** * TODO: Make sure this is desired. - * Right now it only appears to affect the block editor and in unintended ways. - * I *think* we want to set a global default focus-visible style, + * Right this only appears to affect the block editor; and in unintended ways. + * I *think* we want to set a global default focus-visible style for the frontend, * but it should _not_ bleed into the admin/editor. */ /* From 75cdec0b1ef7cfebf256680123de62dc0e38b8e8 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Fri, 27 Oct 2023 10:15:57 -0500 Subject: [PATCH 09/13] Update remaining instances of `wp-site-blocks` --- wp-content/themes/core/assets/pcss/cards/_utilities.pcss | 4 ++-- wp-content/themes/core/blocks/core/posttemplate/style.pcss | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-content/themes/core/assets/pcss/cards/_utilities.pcss b/wp-content/themes/core/assets/pcss/cards/_utilities.pcss index f4d8b7e8..d5e1c549 100644 --- a/wp-content/themes/core/assets/pcss/cards/_utilities.pcss +++ b/wp-content/themes/core/assets/pcss/cards/_utilities.pcss @@ -14,7 +14,7 @@ display: block; padding: 0; - :where(.wp-site-blocks) & { + :where(.wp-block-post-content) & { position: absolute; background: transparent; color: transparent; @@ -74,7 +74,7 @@ } /* this needs to be specific to override global focus visible styles */ - :where(.wp-site-blocks) :not(.wp-element-button) & { + :where(.wp-block-post-content) :not(.wp-element-button) & { &:focus-visible { diff --git a/wp-content/themes/core/blocks/core/posttemplate/style.pcss b/wp-content/themes/core/blocks/core/posttemplate/style.pcss index cf591344..4be0c4e4 100644 --- a/wp-content/themes/core/blocks/core/posttemplate/style.pcss +++ b/wp-content/themes/core/blocks/core/posttemplate/style.pcss @@ -5,7 +5,7 @@ /** * Vertical (list layout) post template spacing */ -.wp-site-blocks .wp-block-post-template:not(.is-layout-grid) .wp-block-post + .wp-block-post { +.wp-block-post-content .wp-block-post-template:not(.is-layout-grid) .wp-block-post + .wp-block-post { margin-block-start: var(--spacer-40); } @@ -17,7 +17,7 @@ * width. The calculations subtract an extra pixel due to calc not enjoying our * use of clamped spacer variables. */ -.wp-site-blocks .wp-block-post-template.is-layout-grid { +.wp-block-post-content .wp-block-post-template.is-layout-grid { --post-template-grid-template-columns: 1fr; gap: var(--spacer-40); grid-template-columns: var(--post-template-grid-template-columns); From 442b505ac2c14e24b17e61c951f245275bbe19ea Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Fri, 27 Oct 2023 10:18:33 -0500 Subject: [PATCH 10/13] linting. --- wp-content/themes/core/assets/pcss/global/reset.pcss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-content/themes/core/assets/pcss/global/reset.pcss b/wp-content/themes/core/assets/pcss/global/reset.pcss index e16ccc8b..3eb25a02 100644 --- a/wp-content/themes/core/assets/pcss/global/reset.pcss +++ b/wp-content/themes/core/assets/pcss/global/reset.pcss @@ -84,9 +84,10 @@ select { /** * TODO: Make sure this is desired. * Right this only appears to affect the block editor; and in unintended ways. - * I *think* we want to set a global default focus-visible style for the frontend, - * but it should _not_ bleed into the admin/editor. + * I *think* we want to set a global default focus-visible style for the + * frontend, but it should _not_ bleed into the admin/editor. */ + /* :where(.wp-site-blocks) *:focus-visible { From c394994c367d0a66fff5505d81dada7fed516679 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Fri, 27 Oct 2023 10:31:21 -0500 Subject: [PATCH 11/13] update comment. --- wp-content/themes/core/assets/pcss/global/reset.pcss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-content/themes/core/assets/pcss/global/reset.pcss b/wp-content/themes/core/assets/pcss/global/reset.pcss index 3eb25a02..64bdb206 100644 --- a/wp-content/themes/core/assets/pcss/global/reset.pcss +++ b/wp-content/themes/core/assets/pcss/global/reset.pcss @@ -83,7 +83,7 @@ select { /** * TODO: Make sure this is desired. - * Right this only appears to affect the block editor; and in unintended ways. + * Currently, this only appears to affect the block editor; and in unintended ways. * I *think* we want to set a global default focus-visible style for the * frontend, but it should _not_ bleed into the admin/editor. */ From 3feb1671e96ce8485c0140271b653b39f16bffb6 Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Fri, 27 Oct 2023 10:36:54 -0500 Subject: [PATCH 12/13] linting. --- wp-content/themes/core/assets/pcss/global/reset.pcss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-content/themes/core/assets/pcss/global/reset.pcss b/wp-content/themes/core/assets/pcss/global/reset.pcss index 64bdb206..3daa2e06 100644 --- a/wp-content/themes/core/assets/pcss/global/reset.pcss +++ b/wp-content/themes/core/assets/pcss/global/reset.pcss @@ -83,7 +83,7 @@ select { /** * TODO: Make sure this is desired. - * Currently, this only appears to affect the block editor; and in unintended ways. + * This only appears to affect the block editor; and in unintended ways. * I *think* we want to set a global default focus-visible style for the * frontend, but it should _not_ bleed into the admin/editor. */ From c864e9e13f1972ed4b6371c8ecba61c82d419b9f Mon Sep 17 00:00:00 2001 From: David Paul Ellenwood Date: Tue, 31 Oct 2023 15:09:20 -0500 Subject: [PATCH 13/13] Update filter definition to fit existing architecture. --- .../plugins/core/src/Blocks/Blocks_Definer.php | 4 ++++ .../core/src/Blocks/Blocks_Subscriber.php | 14 +++----------- .../Filters/Contracts/Block_Content_Filter.php | 2 +- .../core/src/Blocks/Filters/List_Filter.php | 18 ++++++++++++++++++ .../src/Blocks/Filters/Paragraph_Filter.php | 18 ++++++++++++++++++ .../Add_Block_Default_Class_Name.php | 16 ++-------------- 6 files changed, 46 insertions(+), 26 deletions(-) create mode 100644 wp-content/plugins/core/src/Blocks/Filters/List_Filter.php create mode 100644 wp-content/plugins/core/src/Blocks/Filters/Paragraph_Filter.php rename wp-content/plugins/core/src/Blocks/Filters/{ => Traits}/Add_Block_Default_Class_Name.php (82%) diff --git a/wp-content/plugins/core/src/Blocks/Blocks_Definer.php b/wp-content/plugins/core/src/Blocks/Blocks_Definer.php index b100546c..c8ca0eee 100644 --- a/wp-content/plugins/core/src/Blocks/Blocks_Definer.php +++ b/wp-content/plugins/core/src/Blocks/Blocks_Definer.php @@ -5,6 +5,8 @@ use DI; use Tribe\Libs\Container\Definer_Interface; use Tribe\Plugin\Blocks\Filters\Contracts\Filter_Factory; +use Tribe\Plugin\Blocks\Filters\List_Filter; +use Tribe\Plugin\Blocks\Filters\Paragraph_Filter; use Tribe\Theme\blocks\core\button\Button; use Tribe\Theme\blocks\core\column\Column; use Tribe\Theme\blocks\core\columns\Columns; @@ -70,6 +72,8 @@ public function define(): array { ] ), self::FILTERS => DI\add( [ + DI\get( Paragraph_Filter::class ), + DI\get( List_Filter::class ), ] ), Filter_Factory::class => DI\autowire()->constructorParameter( 'filters', DI\get( self::FILTERS ) ), diff --git a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php index 82eb52fd..7c429e9f 100644 --- a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php +++ b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php @@ -3,7 +3,6 @@ namespace Tribe\Plugin\Blocks; use Tribe\Libs\Container\Abstract_Subscriber; -use Tribe\Plugin\Blocks\Filters\Add_Block_Default_Class_Name; use Tribe\Plugin\Blocks\Filters\Contracts\Filter_Factory; use Tribe\Plugin\Blocks\Patterns\Pattern_Category; use Tribe\Plugin\Blocks\Patterns\Pattern_Registrar; @@ -78,17 +77,10 @@ public function register(): void { /** * Filter block content using the render_block filter */ - add_filter( 'render_block', function ( string $block_content, array $block ): string { - $filter = $this->container->get( Filter_Factory::class )->make( $block ); - - return $filter ? $filter->filter_block_content( $block_content, $block ) : $block_content; - }, 10, 2 ); - - /** - * Add a default css class name to specific blocks. - */ add_filter( 'render_block', function ( string $block_content, array $parsed_block, object $block ): string { - return $this->container->get( Add_Block_Default_Class_Name::class )->add_class_name( $block_content, $parsed_block, $block ); + $filter = $this->container->get( Filter_Factory::class )->make( $parsed_block ); + + return $filter ? $filter->filter_block_content( $block_content, $parsed_block, $block ) : $block_content; }, 10, 3 ); /** diff --git a/wp-content/plugins/core/src/Blocks/Filters/Contracts/Block_Content_Filter.php b/wp-content/plugins/core/src/Blocks/Filters/Contracts/Block_Content_Filter.php index 161879ec..1a31bd01 100644 --- a/wp-content/plugins/core/src/Blocks/Filters/Contracts/Block_Content_Filter.php +++ b/wp-content/plugins/core/src/Blocks/Filters/Contracts/Block_Content_Filter.php @@ -6,6 +6,6 @@ abstract class Block_Content_Filter { public const BLOCK = ''; - abstract public function filter_block_content( string $block_content, array $block ): string; + abstract public function filter_block_content( string $block_content, array $parsed_block, object $block ): string; } diff --git a/wp-content/plugins/core/src/Blocks/Filters/List_Filter.php b/wp-content/plugins/core/src/Blocks/Filters/List_Filter.php new file mode 100644 index 00000000..4f9ad111 --- /dev/null +++ b/wp-content/plugins/core/src/Blocks/Filters/List_Filter.php @@ -0,0 +1,18 @@ +add_class_name( $block_content, $parsed_block, $block ); + } + +} diff --git a/wp-content/plugins/core/src/Blocks/Filters/Paragraph_Filter.php b/wp-content/plugins/core/src/Blocks/Filters/Paragraph_Filter.php new file mode 100644 index 00000000..98b16a6d --- /dev/null +++ b/wp-content/plugins/core/src/Blocks/Filters/Paragraph_Filter.php @@ -0,0 +1,18 @@ +add_class_name( $block_content, $parsed_block, $block ); + } + +} diff --git a/wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php b/wp-content/plugins/core/src/Blocks/Filters/Traits/Add_Block_Default_Class_Name.php similarity index 82% rename from wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php rename to wp-content/plugins/core/src/Blocks/Filters/Traits/Add_Block_Default_Class_Name.php index 88ff2683..9b730fad 100644 --- a/wp-content/plugins/core/src/Blocks/Filters/Add_Block_Default_Class_Name.php +++ b/wp-content/plugins/core/src/Blocks/Filters/Traits/Add_Block_Default_Class_Name.php @@ -1,16 +1,8 @@ ` CSS class rendered for the specific blocks mentioned above. @@ -40,10 +32,6 @@ public function add_class_name( string $block_content, array $parsed_block, obje return $block_content; } - if ( ! in_array( $block->name, $this->blocks_to_filter ) ) { - return $block_content; - } - $tags = new \WP_HTML_Tag_Processor( $block_content ); if ( $tags->next_tag() ) { $tags->add_class( wp_get_block_default_classname( $block->name ) );