@automattic/newspack-blocks 4.17.1 → 4.17.3-hotfix-content-loop-more-posts.1

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,17 @@
1
+ ## [4.17.3-hotfix-content-loop-more-posts.1](https://github.com/Automattic/newspack-blocks/compare/v4.17.2...v4.17.3-hotfix-content-loop-more-posts.1) (2025-11-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * content loop load more for custom taxs ([5e52ed5](https://github.com/Automattic/newspack-blocks/commit/5e52ed56699621ccc5544fe2c21b400826ec4394))
7
+
8
+ ## [4.17.2](https://github.com/Automattic/newspack-blocks/compare/v4.17.1...v4.17.2) (2025-11-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * handle multiple responsive iframe blocks ([#2242](https://github.com/Automattic/newspack-blocks/issues/2242)) ([dc218ea](https://github.com/Automattic/newspack-blocks/commit/dc218ea08ecc5f134b5a1dd4e7d4d6a25a8d71e5))
14
+
1
15
  ## [4.17.1](https://github.com/Automattic/newspack-blocks/compare/v4.17.0...v4.17.1) (2025-11-03)
2
16
 
3
17
 
@@ -1 +1 @@
1
- <?php return array('dependencies' => array(), 'version' => '4cfff0cb0974d123a9cf');
1
+ <?php return array('dependencies' => array('wp-dom-ready'), 'version' => '01d2b54a2c5da5c5a760');
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.domReady;e.n(t)()((()=>{Array.from(document.querySelectorAll(".wp-block-newspack-blocks-iframe iframe")).forEach((e=>{const t=setInterval((function(){e.src=e.src}),2e3);e.onload=function(){clearInterval(t)},window.addEventListener("message",(function(t){if(t.origin!==new URL(e.src).origin||e.contentWindow!==t.source)return;let n=0;t.data&&t.data.height&&("number"==typeof t.data.height?n=t.data.height:"string"==typeof t.data.height&&(n=Number(t.data.height))),!isNaN(n)&&n>0&&(e.parentElement&&"auto"!==e.parentElement.style.height&&(e.parentElement.style.height="auto"),e.style.height=n+"px")}))}))}))})();
@@ -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.17.1
10
+ * Version: 4.17.3-hotfix-content-loop-more-posts.1
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.17.1' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.17.3-hotfix-content-loop-more-posts.1' );
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.17.1",
3
+ "version": "4.17.3-hotfix-content-loop-more-posts.1",
4
4
  "author": "Automattic",
5
5
  "devDependencies": {
6
6
  "@rushstack/eslint-patch": "^1.12.0",
@@ -323,19 +323,6 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
323
323
  $styles = 'color: ' . $attributes['customTextColor'] . ';';
324
324
  }
325
325
 
326
- // Handle custom taxonomies.
327
- if ( isset( $attributes['customTaxonomies'] ) ) {
328
- $custom_taxes = $attributes['customTaxonomies'];
329
- unset( $attributes['customTaxonomies'] );
330
- if ( is_array( $custom_taxes ) && ! empty( $custom_taxes ) ) {
331
- foreach ( $custom_taxes as $tax ) {
332
- if ( ! empty( $tax['slug'] ) && ! empty( $tax['terms'] ) ) {
333
- $attributes[ $tax['slug'] ] = $tax['terms'];
334
- }
335
- }
336
- }
337
- }
338
-
339
326
  $articles_rest_url = add_query_arg(
340
327
  array_merge(
341
328
  map_deep(
@@ -1,5 +1,49 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import domReady from '@wordpress/dom-ready';
5
+
1
6
  /**
2
7
  * Style dependencies
3
8
  */
4
9
 
5
10
  import './view.scss';
11
+
12
+ domReady( () => {
13
+ const iframes = Array.from( document.querySelectorAll( '.wp-block-newspack-blocks-iframe iframe' ) );
14
+ iframes.forEach( iframe => {
15
+ const timerId = setInterval( function () {
16
+ iframe.src = iframe.src;
17
+ }, 2000 );
18
+
19
+ iframe.onload = function () {
20
+ clearInterval( timerId );
21
+ };
22
+
23
+ // Add a listener for dynamic resizing if the iframe supports it.
24
+ window.addEventListener( 'message', function ( event ) {
25
+ // Reject messages from untrusted origins.
26
+ if ( event.origin !== new URL( iframe.src ).origin || iframe.contentWindow !== event.source ) {
27
+ return;
28
+ }
29
+
30
+ let iframeHeight = 0;
31
+ if ( event.data && event.data.height ) {
32
+ if ( typeof event.data.height === 'number' ) {
33
+ iframeHeight = event.data.height;
34
+ } else if ( typeof event.data.height === 'string' ) {
35
+ iframeHeight = Number( event.data.height );
36
+ }
37
+ }
38
+ if ( ! isNaN( iframeHeight ) && iframeHeight > 0 ) {
39
+ // Remove height from the iframe's parent element if needed.
40
+ if ( iframe.parentElement && iframe.parentElement.style.height !== 'auto' ) {
41
+ iframe.parentElement.style.height = 'auto';
42
+ }
43
+
44
+ // Set the new height dynamically.
45
+ iframe.style.height = iframeHeight + 'px';
46
+ }
47
+ } );
48
+ } );
49
+ } );
@@ -110,44 +110,6 @@ function newspack_blocks_get_iframe_html( $mode, $src, $height, $width, $is_full
110
110
  ></iframe>
111
111
  </div>
112
112
  </figure>
113
-
114
- <script>
115
- const iframe = document.getElementById("<?php echo esc_attr( $iframe_id ); ?>");
116
- const timerId = setInterval( function() {
117
- iframe.src = iframe.src;
118
- }, 2000 );
119
-
120
- iframe.onload = function() {
121
- clearInterval(timerId);
122
- }
123
-
124
- // Add a listener for dynamic resizing if the iframe supports it.
125
- window.addEventListener("message", function(event) {
126
- // Reject messages from untrusted origins.
127
- if (event.origin !== new URL(iframe.src).origin || iframe.contentWindow !== event.source) {
128
- return;
129
- }
130
-
131
- var iframeHeight = 0;
132
- if (event.data && event.data.height){
133
- if (typeof event.data.height === "number") {
134
- iframeHeight = event.data.height;
135
- } else if (typeof event.data.height === "string") {
136
- iframeHeight = Number(event.data.height);
137
- }
138
- }
139
- if (!isNaN(iframeHeight) && iframeHeight > 0) {
140
- // Remove height from the iframe's parent element if needed.
141
- if (iframe.parentElement && iframe.parentElement.style.height !== "auto") {
142
- iframe.parentElement.style.height = "auto";
143
- }
144
-
145
- // Set the new height dynamically.
146
- iframe.style.height = iframeHeight + "px";
147
- }
148
- });
149
- </script>
150
-
151
113
  <?php
152
114
  return ob_get_clean();
153
115
  }
@@ -3,7 +3,7 @@
3
3
  'name' => 'automattic/newspack-blocks',
4
4
  'pretty_version' => 'dev-trunk',
5
5
  'version' => 'dev-trunk',
6
- 'reference' => 'ba74667f28f674eb028dd1dc613e6b3c90206efa',
6
+ 'reference' => '5e52ed56699621ccc5544fe2c21b400826ec4394',
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' => 'ba74667f28f674eb028dd1dc613e6b3c90206efa',
16
+ 'reference' => '5e52ed56699621ccc5544fe2c21b400826ec4394',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),