@automattic/newspack-blocks 4.12.2 → 4.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.12.3](https://github.com/Automattic/newspack-blocks/compare/v4.12.2...v4.12.3) (2025-06-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **homepage-articles:** revert block inline style enqueue strategy ([#2139](https://github.com/Automattic/newspack-blocks/issues/2139)) ([290edd5](https://github.com/Automattic/newspack-blocks/commit/290edd51f246a797ec47a035fbad0aa5ae086d31))
7
+
1
8
  ## [4.12.2](https://github.com/Automattic/newspack-blocks/compare/v4.12.1...v4.12.2) (2025-06-02)
2
9
 
3
10
 
@@ -7,7 +7,7 @@
7
7
  * Author URI: https://newspack.com/
8
8
  * Text Domain: newspack-blocks
9
9
  * Domain Path: /languages
10
- * Version: 4.12.2
10
+ * Version: 4.12.3
11
11
  *
12
12
  * @package Newspack_Blocks
13
13
  */
@@ -15,7 +15,7 @@
15
15
  define( 'NEWSPACK_BLOCKS__PLUGIN_FILE', __FILE__ );
16
16
  define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
17
17
  define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( NEWSPACK_BLOCKS__PLUGIN_FILE ) );
18
- define( 'NEWSPACK_BLOCKS__VERSION', '4.12.2' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.12.3' );
19
19
 
20
20
  require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks.php';
21
21
  require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'includes/class-newspack-blocks-api.php';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/newspack-blocks",
3
- "version": "4.12.2",
3
+ "version": "4.12.3",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.11.0",
@@ -232,40 +232,22 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
232
232
  return;
233
233
  }
234
234
 
235
- // If the block is rendered in wp_kses_post() call, ensure the `time` tag is allowed.
236
- \add_filter(
237
- 'wp_kses_allowed_html',
238
- function( $tags ) {
239
- $tags['time'] = [
240
- 'class' => true,
241
- 'datetime' => true,
242
- ];
243
- return $tags;
244
- }
245
- );
246
-
247
235
  // Gather all Homepage Articles blocks on the page and output only the needed CSS.
248
- // This CSS will be printed in the document head once.
236
+ // This CSS will be printed along with the first found block markup.
249
237
  global $newspack_blocks_hpb_all_blocks;
250
- static $has_enqueued_styles = false;
251
-
238
+ $inline_style_html = '';
252
239
  if ( ! is_array( $newspack_blocks_hpb_all_blocks ) ) {
253
240
  $newspack_blocks_hpb_all_blocks = newspack_blocks_retrieve_homepage_articles_blocks(
254
241
  parse_blocks( get_the_content() ),
255
242
  $block_name
256
243
  );
257
- $all_used_attrs = newspack_blocks_collect_all_attribute_values( array_column( $newspack_blocks_hpb_all_blocks, 'attrs' ) );
258
-
259
- if ( ! $has_enqueued_styles ) {
260
- $css_string = newspack_blocks_get_homepage_articles_css_string( $all_used_attrs );
261
-
262
- // Enqueue CSS in head instead of adding inline to block content.
263
- wp_register_style( 'newspack-blocks-homepage-articles-inline', false, [], \NEWSPACK_BLOCKS__VERSION );
264
- wp_enqueue_style( 'newspack-blocks-homepage-articles-inline' );
265
- wp_add_inline_style( 'newspack-blocks-homepage-articles-inline', $css_string );
266
-
267
- $has_enqueued_styles = true;
268
- }
244
+ $all_used_attrs = newspack_blocks_collect_all_attribute_values( array_column( $newspack_blocks_hpb_all_blocks, 'attrs' ) );
245
+ $css_string = newspack_blocks_get_homepage_articles_css_string( $all_used_attrs );
246
+ ob_start();
247
+ ?>
248
+ <style id="newspack-blocks-inline-css" type="text/css"><?php echo esc_html( $css_string ); ?></style>
249
+ <?php
250
+ $inline_style_html = ob_get_clean();
269
251
  }
270
252
 
271
253
  // This will let the FSE plugin know we need CSS/JS now.
@@ -380,6 +362,7 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
380
362
  class="<?php echo esc_attr( $classes ); ?>"
381
363
  style="<?php echo esc_attr( $styles ); ?>"
382
364
  >
365
+ <?php echo $inline_style_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
383
366
  <div data-posts data-current-post-id="<?php the_ID(); ?>">
384
367
  <?php if ( '' !== $attributes['sectionHeader'] ) : ?>
385
368
  <h2 class="article-section-title">
@@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
22
22
 
23
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
24
 
25
- return ComposerAutoloaderInit88aae354c1f49f907c8989c59764ad48::getLoader();
25
+ return ComposerAutoloaderInit9e2e8e314628d5030f6030b973fa296b::getLoader();
@@ -2,7 +2,7 @@
2
2
 
3
3
  // autoload_real.php @generated by Composer
4
4
 
5
- class ComposerAutoloaderInit88aae354c1f49f907c8989c59764ad48
5
+ class ComposerAutoloaderInit9e2e8e314628d5030f6030b973fa296b
6
6
  {
7
7
  private static $loader;
8
8
 
@@ -22,12 +22,12 @@ class ComposerAutoloaderInit88aae354c1f49f907c8989c59764ad48
22
22
  return self::$loader;
23
23
  }
24
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit88aae354c1f49f907c8989c59764ad48', 'loadClassLoader'), true, true);
25
+ spl_autoload_register(array('ComposerAutoloaderInit9e2e8e314628d5030f6030b973fa296b', 'loadClassLoader'), true, true);
26
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27
- spl_autoload_unregister(array('ComposerAutoloaderInit88aae354c1f49f907c8989c59764ad48', 'loadClassLoader'));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit9e2e8e314628d5030f6030b973fa296b', 'loadClassLoader'));
28
28
 
29
29
  require __DIR__ . '/autoload_static.php';
30
- call_user_func(\Composer\Autoload\ComposerStaticInit88aae354c1f49f907c8989c59764ad48::getInitializer($loader));
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit9e2e8e314628d5030f6030b973fa296b::getInitializer($loader));
31
31
 
32
32
  $loader->register(true);
33
33
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  namespace Composer\Autoload;
6
6
 
7
- class ComposerStaticInit88aae354c1f49f907c8989c59764ad48
7
+ class ComposerStaticInit9e2e8e314628d5030f6030b973fa296b
8
8
  {
9
9
  public static $classMap = array (
10
10
  'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
@@ -13,7 +13,7 @@ class ComposerStaticInit88aae354c1f49f907c8989c59764ad48
13
13
  public static function getInitializer(ClassLoader $loader)
14
14
  {
15
15
  return \Closure::bind(function () use ($loader) {
16
- $loader->classMap = ComposerStaticInit88aae354c1f49f907c8989c59764ad48::$classMap;
16
+ $loader->classMap = ComposerStaticInit9e2e8e314628d5030f6030b973fa296b::$classMap;
17
17
 
18
18
  }, null, ClassLoader::class);
19
19
  }
@@ -3,7 +3,7 @@
3
3
  'name' => 'automattic/newspack-blocks',
4
4
  'pretty_version' => 'dev-trunk',
5
5
  'version' => 'dev-trunk',
6
- 'reference' => '9a0ef42df61b174e9f18694735f72abc32951477',
6
+ 'reference' => '290edd51f246a797ec47a035fbad0aa5ae086d31',
7
7
  'type' => 'wordpress-plugin',
8
8
  'install_path' => __DIR__ . '/../../',
9
9
  'aliases' => array(),
@@ -13,7 +13,7 @@
13
13
  'automattic/newspack-blocks' => array(
14
14
  'pretty_version' => 'dev-trunk',
15
15
  'version' => 'dev-trunk',
16
- 'reference' => '9a0ef42df61b174e9f18694735f72abc32951477',
16
+ 'reference' => '290edd51f246a797ec47a035fbad0aa5ae086d31',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),