From 17f13c5344807f8e8bd21a08d3865a2cc4f20696 Mon Sep 17 00:00:00 2001 From: scruffian Date: Thu, 8 Jun 2023 15:23:06 +0300 Subject: [PATCH 1/6] Elements: Add support for text area --- lib/class-wp-theme-json-gutenberg.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 5cb11c2d7aaf94..d790658f044cf0 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -497,19 +497,20 @@ class WP_Theme_JSON_Gutenberg { * @var string[] */ const ELEMENTS = array( - 'link' => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity. - 'heading' => 'h1, h2, h3, h4, h5, h6', - 'h1' => 'h1', - 'h2' => 'h2', - 'h3' => 'h3', - 'h4' => 'h4', - 'h5' => 'h5', - 'h6' => 'h6', + 'link' => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity. + 'heading' => 'h1, h2, h3, h4, h5, h6', + 'h1' => 'h1', + 'h2' => 'h2', + 'h3' => 'h3', + 'h4' => 'h4', + 'h5' => 'h5', + 'h6' => 'h6', // We have the .wp-block-button__link class so that this will target older buttons that have been serialized. - 'button' => '.wp-element-button, .wp-block-button__link', + 'button' => '.wp-element-button, .wp-block-button__link', // The block classes are necessary to target older content that won't use the new class names. - 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', - 'cite' => 'cite', + 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', + 'cite' => 'cite', + 'textarea' => 'textarea', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( From f2afb2e5cb8ad890bf3a1772f8c572872f593043 Mon Sep 17 00:00:00 2001 From: scruffian Date: Thu, 8 Jun 2023 15:47:06 +0300 Subject: [PATCH 2/6] target all text inputs --- lib/class-wp-theme-json-gutenberg.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index d790658f044cf0..69a30acab378f4 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -497,20 +497,20 @@ class WP_Theme_JSON_Gutenberg { * @var string[] */ const ELEMENTS = array( - 'link' => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity. - 'heading' => 'h1, h2, h3, h4, h5, h6', - 'h1' => 'h1', - 'h2' => 'h2', - 'h3' => 'h3', - 'h4' => 'h4', - 'h5' => 'h5', - 'h6' => 'h6', + 'link' => 'a:where(:not(.wp-element-button))', // The `where` is needed to lower the specificity. + 'heading' => 'h1, h2, h3, h4, h5, h6', + 'h1' => 'h1', + 'h2' => 'h2', + 'h3' => 'h3', + 'h4' => 'h4', + 'h5' => 'h5', + 'h6' => 'h6', // We have the .wp-block-button__link class so that this will target older buttons that have been serialized. - 'button' => '.wp-element-button, .wp-block-button__link', + 'button' => '.wp-element-button, .wp-block-button__link', // The block classes are necessary to target older content that won't use the new class names. - 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', - 'cite' => 'cite', - 'textarea' => 'textarea', + 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', + 'cite' => 'cite', + 'textInput' => 'textarea, input:not([type=checkbox|type=radio|type=submit])', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( From 37813614a35e5bb14c316ac4093eda98e47c6050 Mon Sep 17 00:00:00 2001 From: scruffian Date: Thu, 8 Jun 2023 15:50:46 +0300 Subject: [PATCH 3/6] add text based inputs --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 69a30acab378f4..3758fdfb28459e 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -510,7 +510,7 @@ class WP_Theme_JSON_Gutenberg { // The block classes are necessary to target older content that won't use the new class names. 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', 'cite' => 'cite', - 'textInput' => 'textarea, input:not([type=checkbox|type=radio|type=submit])', + 'textInput' => 'textarea, input:not([type=checkbox]):not([type=radio]):not([type=submit])', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( From 26b2e2875eb98e5bb13548363a9c506278c2fab4 Mon Sep 17 00:00:00 2001 From: scruffian Date: Thu, 8 Jun 2023 15:55:39 +0300 Subject: [PATCH 4/6] make the CSS lower specificity --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 3758fdfb28459e..aa732587ffa71b 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -510,7 +510,7 @@ class WP_Theme_JSON_Gutenberg { // The block classes are necessary to target older content that won't use the new class names. 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', 'cite' => 'cite', - 'textInput' => 'textarea, input:not([type=checkbox]):not([type=radio]):not([type=submit])', + 'textInput' => 'textarea, input:where(not([type=checkbox]):not([type=radio]):not([type=submit]))', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( From f73935a9aba30e992e5e3553f12d6580f33fc2e2 Mon Sep 17 00:00:00 2001 From: scruffian Date: Tue, 13 Jun 2023 08:07:58 +0100 Subject: [PATCH 5/6] fix CSS --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index aa732587ffa71b..2e8e43ba4bc384 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -510,7 +510,7 @@ class WP_Theme_JSON_Gutenberg { // The block classes are necessary to target older content that won't use the new class names. 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', 'cite' => 'cite', - 'textInput' => 'textarea, input:where(not([type=checkbox]):not([type=radio]):not([type=submit]))', + 'textInput' => 'textarea, input:where(:not([type=checkbox]):not([type=radio]):not([type=submit]))', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( From 3ca066dd5eb68836f73d413e362a6f83e7fc1124 Mon Sep 17 00:00:00 2001 From: scruffian Date: Tue, 13 Jun 2023 16:16:20 +0100 Subject: [PATCH 6/6] update the selector to only target some types --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 2e8e43ba4bc384..7d3f3c5d13bfe8 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -510,7 +510,7 @@ class WP_Theme_JSON_Gutenberg { // The block classes are necessary to target older content that won't use the new class names. 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', 'cite' => 'cite', - 'textInput' => 'textarea, input:where(:not([type=checkbox]):not([type=radio]):not([type=submit]))', + 'textInput' => 'textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=tel],[type=url])', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array(