diff --git a/.monorepo-source.json b/.monorepo-source.json index 103242a..35f4216 100644 --- a/.monorepo-source.json +++ b/.monorepo-source.json @@ -1,7 +1,7 @@ { "productId": "funkycommerce-headless", "repository": "coded-letter/superfunky-theme", - "source": "coded-letter/coded-letter-monorepo@531e554e57237adb670e5e07edbdf0878e1764cc", + "source": "coded-letter/coded-letter-monorepo@86177b0c8ca2c1e1d68cb68f3809a5b9fb0a5d67", "sourcePath": "workspace/backend/wordpress/themes/free/funkycommerce-headless", "installSlug": "funkycommerce-headless", "kind": "theme", diff --git a/functions.php b/functions.php index e3d2c00..7c1e24e 100644 --- a/functions.php +++ b/functions.php @@ -9,7 +9,7 @@ exit; } -define( 'FUNKYCOMMERCE_HEADLESS_VERSION', '1.2.11' ); +define( 'FUNKYCOMMERCE_HEADLESS_VERSION', '1.2.12' ); /** * Whether Superfunky Pro is active and licensed. @@ -1095,16 +1095,63 @@ function funkycommerce_with_headless_shortcode_markers( $callback ) { } } +/** + * Remove WordPress paragraph formatting accidentally stored inside CSS blocks. + */ +function funkycommerce_normalize_headless_style_content( $content ) { + $normalized = preg_replace_callback( + '#(]*>)(.*?)()#is', + static function ( $matches ) { + $style = $matches[2]; + + if ( + ! preg_match( '##i', $style ) + || ! preg_match( '#

\s*]*)?>#i', $style ) + ) { + return $matches[0]; + } + + $style = preg_replace( '##i', "\n", $style ); + $style = preg_replace( '#]*)?>#i', "\n", $style ); + + return $matches[1] . $style . $matches[3]; + }, + $content + ); + + return is_string( $normalized ) ? $normalized : $content; +} + +/** + * Remove paragraph wrappers that content filters add around protected code placeholders. + */ +function funkycommerce_unwrap_headless_code_placeholders( $content ) { + $placeholder = '
';
+	$patterns    = array(
+		'#]*)?>\s*(' . $placeholder . ')\s*

#i', + '#]*)?>\s*(' . $placeholder . ')#i', + '#(' . $placeholder . ')\s*

#i', + ); + + foreach ( $patterns as $pattern ) { + $unwrapped = preg_replace( $pattern, '$1', $content ); + $content = is_string( $unwrapped ) ? $unwrapped : $content; + } + + return $content; +} + /** * Run content filters without allowing paragraph formatting inside code tags. */ function funkycommerce_filter_headless_content( $content, $filter = 'the_content' ) { $preserved = array(); + $content = funkycommerce_normalize_headless_style_content( $content ); $protected = preg_replace_callback( '#<(script|style)\b[^>]*>.*?#is', static function ( $matches ) use ( &$preserved ) { $key = 'fc-preserved-code-' . count( $preserved ); - $placeholder = '
'; + $placeholder = '
';
 			$preserved[ $placeholder ] = $matches[0];
 			return $placeholder;
 		},
@@ -1116,8 +1163,10 @@ static function () use ( $filter, $protected ) {
 			return apply_filters( $filter, $protected );
 		}
 	);
+	$filtered = funkycommerce_unwrap_headless_code_placeholders( $filtered );
+	$filtered = strtr( $filtered, $preserved );
 
-	return strtr( $filtered, $preserved );
+	return funkycommerce_normalize_headless_style_content( $filtered );
 }
 
 /**
diff --git a/package-lock.json b/package-lock.json
index 70938a5..2d5fdb4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "funkycommerce-headless-theme",
-  "version": "1.2.11",
+  "version": "1.2.12",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "funkycommerce-headless-theme",
-      "version": "1.2.11",
+      "version": "1.2.12",
       "devDependencies": {
         "autoprefixer": "^10.4.20",
         "esbuild": "^0.28.2",
diff --git a/package.json b/package.json
index b415d4d..92ee3c8 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "funkycommerce-headless-theme",
   "private": true,
-  "version": "1.2.11",
+  "version": "1.2.12",
   "description": "Tailwind/build tooling for the FunkyCommerce Headless WordPress theme's native frontend assets (block templates, template parts, loader, and Spotify slot).",
   "scripts": {
     "build:css": "tailwindcss -i ./assets/css/theme-source.css -o ./assets/dist/theme.css --minify",
diff --git a/readme.txt b/readme.txt
index e57f540..4458d0e 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: headless, woocommerce, wpgraphql, full-site-editing
 Requires at least: 6.7
 Tested up to: 6.8
 Requires PHP: 7.4
-Stable tag: 1.2.11
+Stable tag: 1.2.12
 License: GPL-2.0-or-later
 License URI: https://www.gnu.org/licenses/gpl-2.0.html
 
@@ -15,6 +15,11 @@ Control Center, the theme also ships a complete native WordPress rendering path
 "Native frontend theme" below) with accessible header/footer/navigation templates and
 core front/home/singular/archive/search/404 routes styled to match the storefront.
 
+== 1.2.12 highlights ==
+
+* Repairs legacy paragraph and line-break markup injected into Custom HTML CSS blocks.
+* Prevents content filters from leaving paragraph wrappers around preserved script and style blocks.
+
 == 1.2.11 highlights ==
 
 * Restores Control Center tab switching after settings were split into safe per-section forms.
diff --git a/style.css b/style.css
index 6e9c43e..27a54f9 100644
--- a/style.css
+++ b/style.css
@@ -7,7 +7,7 @@ Description: A minimal, content-first block theme for polished WordPress preview
 Requires at least: 6.7
 Tested up to: 6.8
 Requires PHP: 7.4
-Version: 1.2.11
+Version: 1.2.12
 Update URI: https://github.com/coded-letter/superfunky-theme
 License: GPL-2.0-or-later
 License URI: https://www.gnu.org/licenses/gpl-2.0.html