@automattic/newspack-blocks 4.34.0-alpha.1 → 4.34.0-alpha.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,16 +1,16 @@
1
- # @automattic/newspack-blocks [4.34.0-alpha.1](https://github.com/Automattic/newspack-workspace/compare/newspack-blocks@4.33.0...newspack-blocks@4.34.0-alpha.1) (2026-09-18)
1
+ # @automattic/newspack-blocks [4.34.0-alpha.3](https://github.com/Automattic/newspack-workspace/compare/newspack-blocks@4.34.0-alpha.2...newspack-blocks@4.34.0-alpha.3) (2026-09-26)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * **author-profile:** load a page's authors in one request instead of one per block ([#1030](https://github.com/Automattic/newspack-workspace/issues/1030)) ([cd3248f](https://github.com/Automattic/newspack-workspace/commit/cd3248fab4588091a045babbbeb70ef819d6c07f))
7
- * **theme:** tighten post subtitle handling ([#1024](https://github.com/Automattic/newspack-workspace/issues/1024)) ([609cd84](https://github.com/Automattic/newspack-workspace/commit/609cd84ad058a21b5b99841394cc7d0c4c1ba4b9))
6
+ * skip Content Loop/Carousel render for REST revisions and autosaves ([26b84c9](https://github.com/Automattic/newspack-workspace/commit/26b84c9e2bbf0021a534c20984eb95b0b33aec43))
8
7
 
8
+ ## @automattic/newspack-blocks [4.33.1](https://github.com/Automattic/newspack-workspace/compare/newspack-blocks@4.33.0...newspack-blocks@4.33.1) (2026-09-21)
9
9
 
10
- ### Features
11
10
 
12
- * **campaigns:** control test for contextual prompts with donation attribution ([#1058](https://github.com/Automattic/newspack-workspace/issues/1058)) ([72d80b8](https://github.com/Automattic/newspack-workspace/commit/72d80b844796b29752e33e290ad8f1ffd923c6f2))
13
- * **plans:** promotional URL generator for modal checkout (NPPD-1707) ([#783](https://github.com/Automattic/newspack-workspace/issues/783)) ([7f5f904](https://github.com/Automattic/newspack-workspace/commit/7f5f90416a2c9598429eae55072ebb1c65328b9b))
11
+ ### Bug Fixes
12
+
13
+ * **iframe:** stop lazy-loaded embeds loading the page inside them ([#1115](https://github.com/Automattic/newspack-workspace/issues/1115)) ([bb97d4c](https://github.com/Automattic/newspack-workspace/commit/bb97d4c46864b3260f24b22690bb570eaf91e404))
14
14
 
15
15
  # @automattic/newspack-blocks [4.33.0](https://github.com/Automattic/newspack-workspace/compare/newspack-blocks@4.32.1...newspack-blocks@4.33.0) (2026-09-18)
16
16
 
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-dom-ready'), 'version' => '0adcb9c939693718d723');
1
+ <?php return array('dependencies' => array('wp-dom-ready'), 'version' => '99e53b29d2f8cbe6ee9e');
@@ -1 +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 a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},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=>{let t=0;const n=setInterval(()=>{!(e=>{const t=e.contentDocument;return null!==t&&"about:blank"===t.URL})(e)||t>=10?clearInterval(n):(t++,e.contentWindow.location.replace(e.src))},2e3);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")})})})})();
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=>{let t=0;const n=setInterval(()=>{!(e=>Boolean(e.getAttribute("src")))(e)||!(e=>{const t=e.contentDocument;return null!==t&&"about:blank"===t.URL})(e)||t>=10?clearInterval(n):(t++,e.contentWindow.location.replace(e.src))},2e3);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")})})})})();
@@ -28,6 +28,19 @@ class Newspack_Blocks {
28
28
  */
29
29
  private static $content_render_depth = 0;
30
30
 
31
+ /**
32
+ * Stack of routes for the REST requests currently being served, innermost
33
+ * last. Pushed on `rest_request_before_callbacks` and popped on
34
+ * `rest_request_after_callbacks`, which bracket the endpoint callback on every
35
+ * dispatch path (HTTP, `rest_do_request()`, batch, embeds, preload). Using a
36
+ * stack, rather than a single value cleared on `rest_post_dispatch`, keeps an
37
+ * in-process request from leaving its route set after it returns, and restores
38
+ * the outer route when a nested request completes.
39
+ *
40
+ * @var string[]
41
+ */
42
+ private static $rest_route_stack = [];
43
+
31
44
  /**
32
45
  * Add hooks and filters.
33
46
  */
@@ -42,6 +55,8 @@ class Newspack_Blocks {
42
55
  add_filter( 'the_content', [ __CLASS__, 'end_content_render_pass' ], PHP_INT_MAX );
43
56
  add_filter( 'body_class', [ __CLASS__, 'add_body_classes' ] );
44
57
  add_filter( 'admin_body_class', [ __CLASS__, 'add_body_classes' ] );
58
+ add_filter( 'rest_request_before_callbacks', [ __CLASS__, 'push_rest_route' ], 10, 3 );
59
+ add_filter( 'rest_request_after_callbacks', [ __CLASS__, 'pop_rest_route' ], 10, 3 );
45
60
 
46
61
  /**
47
62
  * Disable NextGEN's `C_NextGen_Shortcode_Manager`.
@@ -679,6 +694,61 @@ class Newspack_Blocks {
679
694
  return ! $is_front_end;
680
695
  }
681
696
 
697
+ /**
698
+ * Remember the route of the REST request whose callback is about to run.
699
+ *
700
+ * WordPress has no accessor for the request currently in flight, so track it
701
+ * around the endpoint callback. `rest_request_before_callbacks` fires on every
702
+ * dispatch path, including in-process `rest_do_request()` calls that never
703
+ * reach `rest_post_dispatch`, so pairing it with `rest_request_after_callbacks`
704
+ * keeps the route from leaking past the request. Passes the value through
705
+ * unchanged.
706
+ *
707
+ * @param mixed $response Callback result to be replaced, unused here.
708
+ * @param array $handler Matched route handler, unused here.
709
+ * @param WP_REST_Request $request The request being dispatched.
710
+ * @return mixed The unchanged $response.
711
+ */
712
+ public static function push_rest_route( $response, $handler, $request ) {
713
+ self::$rest_route_stack[] = $request->get_route();
714
+ return $response;
715
+ }
716
+
717
+ /**
718
+ * Forget the route once its callback has run, so it never leaks into later work
719
+ * in a long-running process. `rest_request_after_callbacks` fires even when the
720
+ * permission check or callback returned an error, so it always balances the
721
+ * matching `push_rest_route()`.
722
+ *
723
+ * @param mixed $response Callback result to be served, passed through.
724
+ * @param array $handler Matched route handler, unused here.
725
+ * @param WP_REST_Request $request The request that was dispatched, unused here.
726
+ * @return mixed The unchanged $response.
727
+ */
728
+ public static function pop_rest_route( $response, $handler, $request ) {
729
+ array_pop( self::$rest_route_stack );
730
+ return $response;
731
+ }
732
+
733
+ /**
734
+ * Whether the current render is happening while a revision or autosave is being
735
+ * prepared for the REST API.
736
+ *
737
+ * The revisions and autosaves endpoints render a revision's `content.rendered`
738
+ * through `the_content`, which runs every dynamic block's render callback. That
739
+ * output is never displayed, so a Content Loop or Carousel block can skip its
740
+ * query entirely, which matters on sites where the editor autosaves against a
741
+ * large post set. Checks the innermost in-flight route so a nested request is
742
+ * judged on its own endpoint, not an outer one.
743
+ *
744
+ * @return bool
745
+ */
746
+ public static function is_rest_revision_or_autosave_render() {
747
+ $route = end( self::$rest_route_stack );
748
+ return ! empty( $route )
749
+ && (bool) preg_match( '#/(?:revisions|autosaves)(?:/\d+)?$#', $route );
750
+ }
751
+
682
752
  /**
683
753
  * Forget which posts have been rendered so far, so the next Content Loop or
684
754
  * Carousel block starts deduplicating from scratch.
@@ -2,7 +2,7 @@ msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Newspack Blocks\n"
4
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/newspack-blocks\n"
5
- "POT-Creation-Date: 2026-09-18T15:46:55+00:00\n"
5
+ "POT-Creation-Date: 2026-09-26T16:11:40+00:00\n"
6
6
  "PO-Revision-Date: 2024-08-30 08:45-0700\n"
7
7
  "Last-Translator: \n"
8
8
  "Language-Team: \n"
@@ -314,45 +314,45 @@ msgstr ""
314
314
  msgid "Newspack Subscribe"
315
315
  msgstr ""
316
316
 
317
- #: includes/class-newspack-blocks.php:1062
317
+ #: includes/class-newspack-blocks.php:1132
318
318
  msgid "Common"
319
319
  msgstr ""
320
320
 
321
321
  #. translators: separates last two sponsor names; needs a space on either side.
322
- #: includes/class-newspack-blocks.php:1163
322
+ #: includes/class-newspack-blocks.php:1233
323
323
  msgid " and "
324
324
  msgstr " und "
325
325
 
326
326
  #. translators: separates all but the last two sponsor names; needs a space at the end.
327
- #: includes/class-newspack-blocks.php:1166
327
+ #: includes/class-newspack-blocks.php:1236
328
328
  msgid ", "
329
329
  msgstr ""
330
330
 
331
- #: includes/class-newspack-blocks.php:1501
331
+ #: includes/class-newspack-blocks.php:1571
332
332
  msgid "Jetpack donations is disabled in favour of Newspack donations."
333
333
  msgstr ""
334
334
 
335
- #: includes/class-newspack-blocks.php:1534 dist/editor.js:30
335
+ #: includes/class-newspack-blocks.php:1604 dist/editor.js:30
336
336
  #: src/shared/js/utils.js:54
337
337
  msgid "Draft"
338
338
  msgstr ""
339
339
 
340
- #: includes/class-newspack-blocks.php:1535 dist/editor.js:30
340
+ #: includes/class-newspack-blocks.php:1605 dist/editor.js:30
341
341
  #: src/shared/js/utils.js:54
342
342
  msgid "Scheduled"
343
343
  msgstr ""
344
344
 
345
345
  #. Translators: %s is the %s is the frequency.
346
- #: includes/class-newspack-blocks.php:1733 dist/editor.js:52
346
+ #: includes/class-newspack-blocks.php:1803 dist/editor.js:52
347
347
  #, php-format
348
348
  msgid "per %s"
349
349
  msgstr ""
350
350
 
351
- #: includes/class-newspack-blocks.php:1764
351
+ #: includes/class-newspack-blocks.php:1834
352
352
  msgid " once"
353
353
  msgstr ""
354
354
 
355
- #: includes/class-newspack-blocks.php:1767
355
+ #: includes/class-newspack-blocks.php:1837
356
356
  msgid " per "
357
357
  msgstr ""
358
358
 
@@ -566,24 +566,24 @@ msgid "Centered"
566
566
  msgstr ""
567
567
 
568
568
  #. translators: %d: Slide number.
569
- #: src/blocks/carousel/view.php:237
569
+ #: src/blocks/carousel/view.php:243
570
570
  #, php-format
571
571
  msgid "Go to slide %d"
572
572
  msgstr "Gehe zu Bild %d"
573
573
 
574
- #: src/blocks/carousel/view.php:258
574
+ #: src/blocks/carousel/view.php:264
575
575
  msgid "Previous Slide"
576
576
  msgstr "Vorheriger Slide"
577
577
 
578
- #: src/blocks/carousel/view.php:259
578
+ #: src/blocks/carousel/view.php:265
579
579
  msgid "Next Slide"
580
580
  msgstr "Nächste Folie"
581
581
 
582
- #: src/blocks/carousel/view.php:303
582
+ #: src/blocks/carousel/view.php:309
583
583
  msgid "Pause Slideshow"
584
584
  msgstr "Diashow pausieren"
585
585
 
586
- #: src/blocks/carousel/view.php:304
586
+ #: src/blocks/carousel/view.php:310
587
587
  msgid "Play Slideshow"
588
588
  msgstr "Diashow abspielen"
589
589
 
@@ -639,20 +639,20 @@ msgstr "Spendenbetrag"
639
639
  msgid "Other"
640
640
  msgstr "Andere"
641
641
 
642
- #: src/blocks/homepage-articles/view.php:409 dist/editor.js:64
642
+ #: src/blocks/homepage-articles/view.php:415 dist/editor.js:64
643
643
  msgid "Load more posts"
644
644
  msgstr "Mehr Beiträge laden"
645
645
 
646
- #: src/blocks/homepage-articles/view.php:416
646
+ #: src/blocks/homepage-articles/view.php:422
647
647
  msgid "Something went wrong. Please refresh the page and/or try again."
648
648
  msgstr ""
649
649
 
650
- #: src/blocks/homepage-articles/view.php:491
650
+ #: src/blocks/homepage-articles/view.php:497
651
651
  msgctxt "post author"
652
652
  msgid "by"
653
653
  msgstr "von"
654
654
 
655
- #: src/blocks/homepage-articles/view.php:508
655
+ #: src/blocks/homepage-articles/view.php:514
656
656
  msgctxt "post author"
657
657
  msgid " and "
658
658
  msgstr " und "
@@ -2,7 +2,7 @@ msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Newspack Blocks 1.0.0-alpha.20\n"
4
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/newspack-blocks\n"
5
- "POT-Creation-Date: 2026-09-18T15:46:55+00:00\n"
5
+ "POT-Creation-Date: 2026-09-26T16:11:40+00:00\n"
6
6
  "PO-Revision-Date: 2025-08-12T14:56:45+00:00\n"
7
7
  "Last-Translator: \n"
8
8
  "Language-Team: \n"
@@ -306,45 +306,45 @@ msgstr ""
306
306
  msgid "Newspack Subscribe"
307
307
  msgstr ""
308
308
 
309
- #: includes/class-newspack-blocks.php:1062
309
+ #: includes/class-newspack-blocks.php:1132
310
310
  msgid "Common"
311
311
  msgstr ""
312
312
 
313
313
  #. translators: separates last two sponsor names; needs a space on either side.
314
- #: includes/class-newspack-blocks.php:1163
314
+ #: includes/class-newspack-blocks.php:1233
315
315
  msgid " and "
316
316
  msgstr " y "
317
317
 
318
318
  #. translators: separates all but the last two sponsor names; needs a space at the end.
319
- #: includes/class-newspack-blocks.php:1166
319
+ #: includes/class-newspack-blocks.php:1236
320
320
  msgid ", "
321
321
  msgstr ""
322
322
 
323
- #: includes/class-newspack-blocks.php:1501
323
+ #: includes/class-newspack-blocks.php:1571
324
324
  msgid "Jetpack donations is disabled in favour of Newspack donations."
325
325
  msgstr ""
326
326
 
327
- #: includes/class-newspack-blocks.php:1534 dist/editor.js:30
327
+ #: includes/class-newspack-blocks.php:1604 dist/editor.js:30
328
328
  #: src/shared/js/utils.js:54
329
329
  msgid "Draft"
330
330
  msgstr ""
331
331
 
332
- #: includes/class-newspack-blocks.php:1535 dist/editor.js:30
332
+ #: includes/class-newspack-blocks.php:1605 dist/editor.js:30
333
333
  #: src/shared/js/utils.js:54
334
334
  msgid "Scheduled"
335
335
  msgstr ""
336
336
 
337
337
  #. Translators: %s is the %s is the frequency.
338
- #: includes/class-newspack-blocks.php:1733 dist/editor.js:52
338
+ #: includes/class-newspack-blocks.php:1803 dist/editor.js:52
339
339
  #, php-format
340
340
  msgid "per %s"
341
341
  msgstr ""
342
342
 
343
- #: includes/class-newspack-blocks.php:1764
343
+ #: includes/class-newspack-blocks.php:1834
344
344
  msgid " once"
345
345
  msgstr ""
346
346
 
347
- #: includes/class-newspack-blocks.php:1767
347
+ #: includes/class-newspack-blocks.php:1837
348
348
  msgid " per "
349
349
  msgstr ""
350
350
 
@@ -558,24 +558,24 @@ msgid "Centered"
558
558
  msgstr ""
559
559
 
560
560
  #. translators: %d: Slide number.
561
- #: src/blocks/carousel/view.php:237
561
+ #: src/blocks/carousel/view.php:243
562
562
  #, php-format
563
563
  msgid "Go to slide %d"
564
564
  msgstr ""
565
565
 
566
- #: src/blocks/carousel/view.php:258
566
+ #: src/blocks/carousel/view.php:264
567
567
  msgid "Previous Slide"
568
568
  msgstr ""
569
569
 
570
- #: src/blocks/carousel/view.php:259
570
+ #: src/blocks/carousel/view.php:265
571
571
  msgid "Next Slide"
572
572
  msgstr ""
573
573
 
574
- #: src/blocks/carousel/view.php:303
574
+ #: src/blocks/carousel/view.php:309
575
575
  msgid "Pause Slideshow"
576
576
  msgstr ""
577
577
 
578
- #: src/blocks/carousel/view.php:304
578
+ #: src/blocks/carousel/view.php:310
579
579
  msgid "Play Slideshow"
580
580
  msgstr ""
581
581
 
@@ -631,20 +631,20 @@ msgstr "Monto de la donación"
631
631
  msgid "Other"
632
632
  msgstr "Otro"
633
633
 
634
- #: src/blocks/homepage-articles/view.php:409 dist/editor.js:64
634
+ #: src/blocks/homepage-articles/view.php:415 dist/editor.js:64
635
635
  msgid "Load more posts"
636
636
  msgstr ""
637
637
 
638
- #: src/blocks/homepage-articles/view.php:416
638
+ #: src/blocks/homepage-articles/view.php:422
639
639
  msgid "Something went wrong. Please refresh the page and/or try again."
640
640
  msgstr ""
641
641
 
642
- #: src/blocks/homepage-articles/view.php:491
642
+ #: src/blocks/homepage-articles/view.php:497
643
643
  msgctxt "post author"
644
644
  msgid "by"
645
645
  msgstr "por"
646
646
 
647
- #: src/blocks/homepage-articles/view.php:508
647
+ #: src/blocks/homepage-articles/view.php:514
648
648
  msgctxt "post author"
649
649
  msgid " and "
650
650
  msgstr " y "
@@ -2,7 +2,7 @@ msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Newspack Blocks 1.0.0-alpha.25\n"
4
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/newspack-blocks\n"
5
- "POT-Creation-Date: 2026-09-18T15:46:55+00:00\n"
5
+ "POT-Creation-Date: 2026-09-26T16:11:40+00:00\n"
6
6
  "PO-Revision-Date: 2024-08-30 08:46-0700\n"
7
7
  "Last-Translator: \n"
8
8
  "Language-Team: \n"
@@ -306,45 +306,45 @@ msgstr ""
306
306
  msgid "Newspack Subscribe"
307
307
  msgstr ""
308
308
 
309
- #: includes/class-newspack-blocks.php:1062
309
+ #: includes/class-newspack-blocks.php:1132
310
310
  msgid "Common"
311
311
  msgstr ""
312
312
 
313
313
  #. translators: separates last two sponsor names; needs a space on either side.
314
- #: includes/class-newspack-blocks.php:1163
314
+ #: includes/class-newspack-blocks.php:1233
315
315
  msgid " and "
316
316
  msgstr " et "
317
317
 
318
318
  #. translators: separates all but the last two sponsor names; needs a space at the end.
319
- #: includes/class-newspack-blocks.php:1166
319
+ #: includes/class-newspack-blocks.php:1236
320
320
  msgid ", "
321
321
  msgstr ""
322
322
 
323
- #: includes/class-newspack-blocks.php:1501
323
+ #: includes/class-newspack-blocks.php:1571
324
324
  msgid "Jetpack donations is disabled in favour of Newspack donations."
325
325
  msgstr ""
326
326
 
327
- #: includes/class-newspack-blocks.php:1534 dist/editor.js:30
327
+ #: includes/class-newspack-blocks.php:1604 dist/editor.js:30
328
328
  #: src/shared/js/utils.js:54
329
329
  msgid "Draft"
330
330
  msgstr ""
331
331
 
332
- #: includes/class-newspack-blocks.php:1535 dist/editor.js:30
332
+ #: includes/class-newspack-blocks.php:1605 dist/editor.js:30
333
333
  #: src/shared/js/utils.js:54
334
334
  msgid "Scheduled"
335
335
  msgstr ""
336
336
 
337
337
  #. Translators: %s is the %s is the frequency.
338
- #: includes/class-newspack-blocks.php:1733 dist/editor.js:52
338
+ #: includes/class-newspack-blocks.php:1803 dist/editor.js:52
339
339
  #, php-format
340
340
  msgid "per %s"
341
341
  msgstr ""
342
342
 
343
- #: includes/class-newspack-blocks.php:1764
343
+ #: includes/class-newspack-blocks.php:1834
344
344
  msgid " once"
345
345
  msgstr ""
346
346
 
347
- #: includes/class-newspack-blocks.php:1767
347
+ #: includes/class-newspack-blocks.php:1837
348
348
  msgid " per "
349
349
  msgstr ""
350
350
 
@@ -558,24 +558,24 @@ msgid "Centered"
558
558
  msgstr ""
559
559
 
560
560
  #. translators: %d: Slide number.
561
- #: src/blocks/carousel/view.php:237
561
+ #: src/blocks/carousel/view.php:243
562
562
  #, php-format
563
563
  msgid "Go to slide %d"
564
564
  msgstr "Allez à la diapositive %d"
565
565
 
566
- #: src/blocks/carousel/view.php:258
566
+ #: src/blocks/carousel/view.php:264
567
567
  msgid "Previous Slide"
568
568
  msgstr "Diapositive précédente"
569
569
 
570
- #: src/blocks/carousel/view.php:259
570
+ #: src/blocks/carousel/view.php:265
571
571
  msgid "Next Slide"
572
572
  msgstr "Diapositive suivante"
573
573
 
574
- #: src/blocks/carousel/view.php:303
574
+ #: src/blocks/carousel/view.php:309
575
575
  msgid "Pause Slideshow"
576
576
  msgstr "Mettre le diaporama en pause"
577
577
 
578
- #: src/blocks/carousel/view.php:304
578
+ #: src/blocks/carousel/view.php:310
579
579
  msgid "Play Slideshow"
580
580
  msgstr "Démarrer le diaporama"
581
581
 
@@ -631,21 +631,21 @@ msgstr "Montant du don"
631
631
  msgid "Other"
632
632
  msgstr "Autre"
633
633
 
634
- #: src/blocks/homepage-articles/view.php:409 dist/editor.js:64
634
+ #: src/blocks/homepage-articles/view.php:415 dist/editor.js:64
635
635
  msgid "Load more posts"
636
636
  msgstr "Charger plus d’articles"
637
637
 
638
- #: src/blocks/homepage-articles/view.php:416
638
+ #: src/blocks/homepage-articles/view.php:422
639
639
  msgid "Something went wrong. Please refresh the page and/or try again."
640
640
  msgstr ""
641
641
  "Un problème est survenu. Veuillez actualiser la page et / ou réessayer."
642
642
 
643
- #: src/blocks/homepage-articles/view.php:491
643
+ #: src/blocks/homepage-articles/view.php:497
644
644
  msgctxt "post author"
645
645
  msgid "by"
646
646
  msgstr "par"
647
647
 
648
- #: src/blocks/homepage-articles/view.php:508
648
+ #: src/blocks/homepage-articles/view.php:514
649
649
  msgctxt "post author"
650
650
  msgid " and "
651
651
  msgstr " et "
@@ -2,7 +2,7 @@ msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Newspack Blocks 1.0.0-alpha.20\n"
4
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/newspack-blocks\n"
5
- "POT-Creation-Date: 2026-09-18T15:46:55+00:00\n"
5
+ "POT-Creation-Date: 2026-09-26T16:11:40+00:00\n"
6
6
  "PO-Revision-Date: 2024-08-30 08:46-0700\n"
7
7
  "Last-Translator: \n"
8
8
  "Language-Team: \n"
@@ -305,45 +305,45 @@ msgstr ""
305
305
  msgid "Newspack Subscribe"
306
306
  msgstr ""
307
307
 
308
- #: includes/class-newspack-blocks.php:1062
308
+ #: includes/class-newspack-blocks.php:1132
309
309
  msgid "Common"
310
310
  msgstr ""
311
311
 
312
312
  #. translators: separates last two sponsor names; needs a space on either side.
313
- #: includes/class-newspack-blocks.php:1163
313
+ #: includes/class-newspack-blocks.php:1233
314
314
  msgid " and "
315
315
  msgstr " og "
316
316
 
317
317
  #. translators: separates all but the last two sponsor names; needs a space at the end.
318
- #: includes/class-newspack-blocks.php:1166
318
+ #: includes/class-newspack-blocks.php:1236
319
319
  msgid ", "
320
320
  msgstr ""
321
321
 
322
- #: includes/class-newspack-blocks.php:1501
322
+ #: includes/class-newspack-blocks.php:1571
323
323
  msgid "Jetpack donations is disabled in favour of Newspack donations."
324
324
  msgstr ""
325
325
 
326
- #: includes/class-newspack-blocks.php:1534 dist/editor.js:30
326
+ #: includes/class-newspack-blocks.php:1604 dist/editor.js:30
327
327
  #: src/shared/js/utils.js:54
328
328
  msgid "Draft"
329
329
  msgstr ""
330
330
 
331
- #: includes/class-newspack-blocks.php:1535 dist/editor.js:30
331
+ #: includes/class-newspack-blocks.php:1605 dist/editor.js:30
332
332
  #: src/shared/js/utils.js:54
333
333
  msgid "Scheduled"
334
334
  msgstr ""
335
335
 
336
336
  #. Translators: %s is the %s is the frequency.
337
- #: includes/class-newspack-blocks.php:1733 dist/editor.js:52
337
+ #: includes/class-newspack-blocks.php:1803 dist/editor.js:52
338
338
  #, php-format
339
339
  msgid "per %s"
340
340
  msgstr ""
341
341
 
342
- #: includes/class-newspack-blocks.php:1764
342
+ #: includes/class-newspack-blocks.php:1834
343
343
  msgid " once"
344
344
  msgstr ""
345
345
 
346
- #: includes/class-newspack-blocks.php:1767
346
+ #: includes/class-newspack-blocks.php:1837
347
347
  msgid " per "
348
348
  msgstr ""
349
349
 
@@ -557,24 +557,24 @@ msgid "Centered"
557
557
  msgstr ""
558
558
 
559
559
  #. translators: %d: Slide number.
560
- #: src/blocks/carousel/view.php:237
560
+ #: src/blocks/carousel/view.php:243
561
561
  #, php-format
562
562
  msgid "Go to slide %d"
563
563
  msgstr ""
564
564
 
565
- #: src/blocks/carousel/view.php:258
565
+ #: src/blocks/carousel/view.php:264
566
566
  msgid "Previous Slide"
567
567
  msgstr ""
568
568
 
569
- #: src/blocks/carousel/view.php:259
569
+ #: src/blocks/carousel/view.php:265
570
570
  msgid "Next Slide"
571
571
  msgstr ""
572
572
 
573
- #: src/blocks/carousel/view.php:303
573
+ #: src/blocks/carousel/view.php:309
574
574
  msgid "Pause Slideshow"
575
575
  msgstr ""
576
576
 
577
- #: src/blocks/carousel/view.php:304
577
+ #: src/blocks/carousel/view.php:310
578
578
  msgid "Play Slideshow"
579
579
  msgstr ""
580
580
 
@@ -630,20 +630,20 @@ msgstr "Mengde donasjon"
630
630
  msgid "Other"
631
631
  msgstr "Annet"
632
632
 
633
- #: src/blocks/homepage-articles/view.php:409 dist/editor.js:64
633
+ #: src/blocks/homepage-articles/view.php:415 dist/editor.js:64
634
634
  msgid "Load more posts"
635
635
  msgstr "Last flere innlegg"
636
636
 
637
- #: src/blocks/homepage-articles/view.php:416
637
+ #: src/blocks/homepage-articles/view.php:422
638
638
  msgid "Something went wrong. Please refresh the page and/or try again."
639
639
  msgstr "Noe gikk galt. Oppdater siden og/eller prøv igjen."
640
640
 
641
- #: src/blocks/homepage-articles/view.php:491
641
+ #: src/blocks/homepage-articles/view.php:497
642
642
  msgctxt "post author"
643
643
  msgid "by"
644
644
  msgstr "av"
645
645
 
646
- #: src/blocks/homepage-articles/view.php:508
646
+ #: src/blocks/homepage-articles/view.php:514
647
647
  msgctxt "post author"
648
648
  msgid " and "
649
649
  msgstr " og "
@@ -2,7 +2,7 @@ msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Newspack Blocks 1.0.0-alpha.25\n"
4
4
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/newspack-blocks\n"
5
- "POT-Creation-Date: 2026-09-18T15:46:55+00:00\n"
5
+ "POT-Creation-Date: 2026-09-26T16:11:40+00:00\n"
6
6
  "PO-Revision-Date: 2024-08-30 08:46-0700\n"
7
7
  "Last-Translator: \n"
8
8
  "Language-Team: \n"
@@ -304,45 +304,45 @@ msgstr ""
304
304
  msgid "Newspack Subscribe"
305
305
  msgstr ""
306
306
 
307
- #: includes/class-newspack-blocks.php:1062
307
+ #: includes/class-newspack-blocks.php:1132
308
308
  msgid "Common"
309
309
  msgstr ""
310
310
 
311
311
  #. translators: separates last two sponsor names; needs a space on either side.
312
- #: includes/class-newspack-blocks.php:1163
312
+ #: includes/class-newspack-blocks.php:1233
313
313
  msgid " and "
314
314
  msgstr " e "
315
315
 
316
316
  #. translators: separates all but the last two sponsor names; needs a space at the end.
317
- #: includes/class-newspack-blocks.php:1166
317
+ #: includes/class-newspack-blocks.php:1236
318
318
  msgid ", "
319
319
  msgstr ""
320
320
 
321
- #: includes/class-newspack-blocks.php:1501
321
+ #: includes/class-newspack-blocks.php:1571
322
322
  msgid "Jetpack donations is disabled in favour of Newspack donations."
323
323
  msgstr ""
324
324
 
325
- #: includes/class-newspack-blocks.php:1534 dist/editor.js:30
325
+ #: includes/class-newspack-blocks.php:1604 dist/editor.js:30
326
326
  #: src/shared/js/utils.js:54
327
327
  msgid "Draft"
328
328
  msgstr ""
329
329
 
330
- #: includes/class-newspack-blocks.php:1535 dist/editor.js:30
330
+ #: includes/class-newspack-blocks.php:1605 dist/editor.js:30
331
331
  #: src/shared/js/utils.js:54
332
332
  msgid "Scheduled"
333
333
  msgstr ""
334
334
 
335
335
  #. Translators: %s is the %s is the frequency.
336
- #: includes/class-newspack-blocks.php:1733 dist/editor.js:52
336
+ #: includes/class-newspack-blocks.php:1803 dist/editor.js:52
337
337
  #, php-format
338
338
  msgid "per %s"
339
339
  msgstr ""
340
340
 
341
- #: includes/class-newspack-blocks.php:1764
341
+ #: includes/class-newspack-blocks.php:1834
342
342
  msgid " once"
343
343
  msgstr ""
344
344
 
345
- #: includes/class-newspack-blocks.php:1767
345
+ #: includes/class-newspack-blocks.php:1837
346
346
  msgid " per "
347
347
  msgstr ""
348
348
 
@@ -556,24 +556,24 @@ msgid "Centered"
556
556
  msgstr ""
557
557
 
558
558
  #. translators: %d: Slide number.
559
- #: src/blocks/carousel/view.php:237
559
+ #: src/blocks/carousel/view.php:243
560
560
  #, php-format
561
561
  msgid "Go to slide %d"
562
562
  msgstr ""
563
563
 
564
- #: src/blocks/carousel/view.php:258
564
+ #: src/blocks/carousel/view.php:264
565
565
  msgid "Previous Slide"
566
566
  msgstr "Slide Anterior"
567
567
 
568
- #: src/blocks/carousel/view.php:259
568
+ #: src/blocks/carousel/view.php:265
569
569
  msgid "Next Slide"
570
570
  msgstr "Próximo Slide"
571
571
 
572
- #: src/blocks/carousel/view.php:303
572
+ #: src/blocks/carousel/view.php:309
573
573
  msgid "Pause Slideshow"
574
574
  msgstr "Pausa na apresentação"
575
575
 
576
- #: src/blocks/carousel/view.php:304
576
+ #: src/blocks/carousel/view.php:310
577
577
  msgid "Play Slideshow"
578
578
  msgstr ""
579
579
 
@@ -629,20 +629,20 @@ msgstr "Valor da Doação"
629
629
  msgid "Other"
630
630
  msgstr "Outro"
631
631
 
632
- #: src/blocks/homepage-articles/view.php:409 dist/editor.js:64
632
+ #: src/blocks/homepage-articles/view.php:415 dist/editor.js:64
633
633
  msgid "Load more posts"
634
634
  msgstr "Carregar mais posts"
635
635
 
636
- #: src/blocks/homepage-articles/view.php:416
636
+ #: src/blocks/homepage-articles/view.php:422
637
637
  msgid "Something went wrong. Please refresh the page and/or try again."
638
638
  msgstr ""
639
639
 
640
- #: src/blocks/homepage-articles/view.php:491
640
+ #: src/blocks/homepage-articles/view.php:497
641
641
  msgctxt "post author"
642
642
  msgid "by"
643
643
  msgstr "por"
644
644
 
645
- #: src/blocks/homepage-articles/view.php:508
645
+ #: src/blocks/homepage-articles/view.php:514
646
646
  msgctxt "post author"
647
647
  msgid " and "
648
648
  msgstr " e "
@@ -2,14 +2,14 @@
2
2
  # This file is distributed under the same license as the Newspack Blocks plugin.
3
3
  msgid ""
4
4
  msgstr ""
5
- "Project-Id-Version: Newspack Blocks 4.34.0-alpha.1\n"
5
+ "Project-Id-Version: Newspack Blocks 4.34.0-alpha.3\n"
6
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/newspack-blocks\n"
7
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
9
  "MIME-Version: 1.0\n"
10
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2026-09-18T15:46:55+00:00\n"
12
+ "POT-Creation-Date: 2026-09-26T16:11:40+00:00\n"
13
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
14
  "X-Generator: WP-CLI 2.12.0\n"
15
15
  "X-Domain: newspack-blocks\n"
@@ -298,48 +298,48 @@ msgstr ""
298
298
  msgid "Newspack Subscribe"
299
299
  msgstr ""
300
300
 
301
- #: includes/class-newspack-blocks.php:1062
301
+ #: includes/class-newspack-blocks.php:1132
302
302
  msgid "Common"
303
303
  msgstr ""
304
304
 
305
305
  #. translators: separates last two sponsor names; needs a space on either side.
306
- #: includes/class-newspack-blocks.php:1163
306
+ #: includes/class-newspack-blocks.php:1233
307
307
  msgid " and "
308
308
  msgstr ""
309
309
 
310
310
  #. translators: separates all but the last two sponsor names; needs a space at the end.
311
- #: includes/class-newspack-blocks.php:1166
311
+ #: includes/class-newspack-blocks.php:1236
312
312
  msgid ", "
313
313
  msgstr ""
314
314
 
315
- #: includes/class-newspack-blocks.php:1501
315
+ #: includes/class-newspack-blocks.php:1571
316
316
  msgid "Jetpack donations is disabled in favour of Newspack donations."
317
317
  msgstr ""
318
318
 
319
- #: includes/class-newspack-blocks.php:1534
319
+ #: includes/class-newspack-blocks.php:1604
320
320
  #: dist/editor.js:30
321
321
  #: src/shared/js/utils.js:54
322
322
  msgid "Draft"
323
323
  msgstr ""
324
324
 
325
- #: includes/class-newspack-blocks.php:1535
325
+ #: includes/class-newspack-blocks.php:1605
326
326
  #: dist/editor.js:30
327
327
  #: src/shared/js/utils.js:54
328
328
  msgid "Scheduled"
329
329
  msgstr ""
330
330
 
331
331
  #. Translators: %s is the %s is the frequency.
332
- #: includes/class-newspack-blocks.php:1733
332
+ #: includes/class-newspack-blocks.php:1803
333
333
  #: dist/editor.js:52
334
334
  #, php-format,js-format
335
335
  msgid "per %s"
336
336
  msgstr ""
337
337
 
338
- #: includes/class-newspack-blocks.php:1764
338
+ #: includes/class-newspack-blocks.php:1834
339
339
  msgid " once"
340
340
  msgstr ""
341
341
 
342
- #: includes/class-newspack-blocks.php:1767
342
+ #: includes/class-newspack-blocks.php:1837
343
343
  msgid " per "
344
344
  msgstr ""
345
345
 
@@ -569,24 +569,24 @@ msgid "Centered"
569
569
  msgstr ""
570
570
 
571
571
  #. translators: %d: Slide number.
572
- #: src/blocks/carousel/view.php:237
572
+ #: src/blocks/carousel/view.php:243
573
573
  #, php-format
574
574
  msgid "Go to slide %d"
575
575
  msgstr ""
576
576
 
577
- #: src/blocks/carousel/view.php:258
577
+ #: src/blocks/carousel/view.php:264
578
578
  msgid "Previous Slide"
579
579
  msgstr ""
580
580
 
581
- #: src/blocks/carousel/view.php:259
581
+ #: src/blocks/carousel/view.php:265
582
582
  msgid "Next Slide"
583
583
  msgstr ""
584
584
 
585
- #: src/blocks/carousel/view.php:303
585
+ #: src/blocks/carousel/view.php:309
586
586
  msgid "Pause Slideshow"
587
587
  msgstr ""
588
588
 
589
- #: src/blocks/carousel/view.php:304
589
+ #: src/blocks/carousel/view.php:310
590
590
  msgid "Play Slideshow"
591
591
  msgstr ""
592
592
 
@@ -641,21 +641,21 @@ msgstr ""
641
641
  msgid "Other"
642
642
  msgstr ""
643
643
 
644
- #: src/blocks/homepage-articles/view.php:409
644
+ #: src/blocks/homepage-articles/view.php:415
645
645
  #: dist/editor.js:64
646
646
  msgid "Load more posts"
647
647
  msgstr ""
648
648
 
649
- #: src/blocks/homepage-articles/view.php:416
649
+ #: src/blocks/homepage-articles/view.php:422
650
650
  msgid "Something went wrong. Please refresh the page and/or try again."
651
651
  msgstr ""
652
652
 
653
- #: src/blocks/homepage-articles/view.php:491
653
+ #: src/blocks/homepage-articles/view.php:497
654
654
  msgctxt "post author"
655
655
  msgid "by"
656
656
  msgstr ""
657
657
 
658
- #: src/blocks/homepage-articles/view.php:508
658
+ #: src/blocks/homepage-articles/view.php:514
659
659
  msgctxt "post author"
660
660
  msgid " and "
661
661
  msgstr ""
@@ -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.34.0-alpha.1
10
+ * Version: 4.34.0-alpha.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.34.0-alpha.1' );
18
+ define( 'NEWSPACK_BLOCKS__VERSION', '4.34.0-alpha.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.34.0-alpha.1",
3
+ "version": "4.34.0-alpha.3",
4
4
  "author": "Automattic",
5
5
  "description": "=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html",
6
6
  "repository": {
@@ -19,6 +19,12 @@ function newspack_blocks_render_block_carousel( $attributes ) {
19
19
  return;
20
20
  }
21
21
 
22
+ // Skip the query when a revision or autosave is being prepared for the REST
23
+ // API: the output is never shown, and the query is costly on large sites.
24
+ if ( Newspack_Blocks::is_rest_revision_or_autosave_render() ) {
25
+ return '';
26
+ }
27
+
22
28
  static $newspack_blocks_carousel_id = 0;
23
29
  global $newspack_blocks_post_id;
24
30
 
@@ -256,6 +256,12 @@ function newspack_blocks_render_block_homepage_articles( $attributes ) {
256
256
  return;
257
257
  }
258
258
 
259
+ // Skip the query when a revision or autosave is being prepared for the REST
260
+ // API: the output is never shown, and the query is costly on large sites.
261
+ if ( Newspack_Blocks::is_rest_revision_or_autosave_render() ) {
262
+ return '';
263
+ }
264
+
259
265
  $block_name = apply_filters( 'newspack_blocks_block_name', 'newspack-blocks/homepage-articles' );
260
266
  $article_query = new WP_Query( Newspack_Blocks::build_articles_query( $attributes, $block_name ) );
261
267
  if ( ! $article_query->have_posts() ) {
@@ -26,6 +26,18 @@ const isStillBlank = iframe => {
26
26
  return doc !== null && doc.URL === 'about:blank';
27
27
  };
28
28
 
29
+ /**
30
+ * Whether the frame has an address of its own to retry. A lazy loader can hold it
31
+ * back until the frame nears the viewport (perfmatters moves it to data-src). With
32
+ * no src, iframe.src is '', which location.replace() resolves to this page, and an
33
+ * empty src attribute reads back as this page's URL. Either way a retry would load
34
+ * the page inside its own frame, where this script runs again on the copy's frames.
35
+ *
36
+ * @param {HTMLIFrameElement} iframe The iframe.
37
+ * @return {boolean} Whether the frame has a src to load.
38
+ */
39
+ const hasOwnSrc = iframe => Boolean( iframe.getAttribute( 'src' ) );
40
+
29
41
  /**
30
42
  * Re-navigations before giving up on a frame that never loads. A 204 resolves in a
31
43
  * retry or two; without a bound, a permanently blank embed keeps requesting for as
@@ -39,10 +51,11 @@ domReady( () => {
39
51
  // Don't wait for the load event: it may have fired before this script ran
40
52
  // (delayed JS). Navigate with location.replace(), since resetting src on a
41
53
  // loaded frame adds a history entry and makes readers press Back twice
42
- // (NPPM-3180).
54
+ // (NPPM-3180). The src check runs on each tick rather than once here, so a
55
+ // frame a lazy loader fills in before the first tick still gets its retries.
43
56
  let attempts = 0;
44
57
  const retry = setInterval( () => {
45
- if ( ! isStillBlank( iframe ) || attempts >= MAX_RETRIES ) {
58
+ if ( ! hasOwnSrc( iframe ) || ! isStillBlank( iframe ) || attempts >= MAX_RETRIES ) {
46
59
  clearInterval( retry );
47
60
  return;
48
61
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The iframe block's retry (NPPM-3180) must leave a frame that already holds a
3
- * document alone, and must never reset `src`, which adds a history entry.
3
+ * document alone, must never reset `src`, which adds a history entry, and must
4
+ * never navigate a frame with no src of its own, which would load the page inside it.
4
5
  */
5
6
 
6
7
  const SRC = 'https://embed.example.test/widget';
@@ -14,10 +15,12 @@ const SRC = 'https://embed.example.test/widget';
14
15
  * null once a cross-origin document has loaded.
15
16
  * A detached frame reports null, as does its
16
17
  * contentWindow.
18
+ * @param {string} attributes The frame's markup attributes. A lazy loader may have
19
+ * moved the address out of src.
17
20
  * @return {Object} The iframe, its state holder, and the `replace` and `setSrc` spies.
18
21
  */
19
- function renderIframe( contentDocument ) {
20
- document.body.innerHTML = `<figure class="wp-block-newspack-blocks-iframe"><div class="wp-block-embed__wrapper"><iframe src="${ SRC }"></iframe></div></figure>`;
22
+ function renderIframe( contentDocument, attributes = `src="${ SRC }"` ) {
23
+ document.body.innerHTML = `<figure class="wp-block-newspack-blocks-iframe"><div class="wp-block-embed__wrapper"><iframe ${ attributes }></iframe></div></figure>`;
21
24
  const iframe = document.querySelector( 'iframe' );
22
25
  const state = { contentDocument };
23
26
  const replace = jest.fn();
@@ -25,7 +28,12 @@ function renderIframe( contentDocument ) {
25
28
  const contentWindow = { location: { replace } };
26
29
  Object.defineProperty( iframe, 'contentDocument', { configurable: true, get: () => ( iframe.isConnected ? state.contentDocument : null ) } );
27
30
  Object.defineProperty( iframe, 'contentWindow', { configurable: true, get: () => ( iframe.isConnected ? contentWindow : null ) } );
28
- Object.defineProperty( iframe, 'src', { configurable: true, get: () => SRC, set: setSrc } );
31
+ // Read src back as a browser does: '' with no attribute, otherwise the value resolved against the page.
32
+ Object.defineProperty( iframe, 'src', {
33
+ configurable: true,
34
+ get: () => ( iframe.hasAttribute( 'src' ) ? new URL( iframe.getAttribute( 'src' ), document.baseURI ).href : '' ),
35
+ set: setSrc,
36
+ } );
29
37
  jest.isolateModules( () => require( './view' ) );
30
38
  return { iframe, state, replace, setSrc };
31
39
  }
@@ -73,6 +81,26 @@ describe( 'iframe block view script', () => {
73
81
  expect( setSrc ).not.toHaveBeenCalled();
74
82
  } );
75
83
 
84
+ it.each( [
85
+ // perfmatters' markup: the address waits in data-src until the frame nears the viewport.
86
+ [ 'no src', `class="perfmatters-lazy" data-src="${ SRC }"` ],
87
+ [ 'an empty src', 'src=""' ],
88
+ ] )( 'never navigates a blank frame with %s, which would load this page inside it', ( _, attributes ) => {
89
+ const { replace, setSrc } = renderIframe( { URL: 'about:blank' }, attributes );
90
+ jest.advanceTimersByTime( 20000 );
91
+ expect( replace ).not.toHaveBeenCalled();
92
+ expect( setSrc ).not.toHaveBeenCalled();
93
+ expect( jest.getTimerCount() ).toBe( 0 );
94
+ } );
95
+
96
+ it( 'retries a lazy-loaded frame that has its src by the first check', () => {
97
+ const { iframe, replace } = renderIframe( { URL: 'about:blank' }, `class="perfmatters-lazy" data-src="${ SRC }"` );
98
+ // The lazy loader copies data-src into src as the frame nears the viewport.
99
+ iframe.setAttribute( 'src', SRC );
100
+ jest.advanceTimersByTime( 2000 );
101
+ expect( replace ).toHaveBeenCalledWith( SRC );
102
+ } );
103
+
76
104
  it( 'gives up after 10 attempts on a frame that never loads', () => {
77
105
  const { replace } = renderIframe( { URL: 'about:blank' } );
78
106
  jest.advanceTimersByTime( 20000 );
@@ -3,7 +3,7 @@
3
3
  'name' => 'automattic/newspack-blocks',
4
4
  'pretty_version' => 'dev-main',
5
5
  'version' => 'dev-main',
6
- 'reference' => '6e1c42b33a3db69c07a0a76204f71e5e96821d9e',
6
+ 'reference' => '8d558bad69f1db256c80422ca245624512a2a47c',
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-main',
15
15
  'version' => 'dev-main',
16
- 'reference' => '6e1c42b33a3db69c07a0a76204f71e5e96821d9e',
16
+ 'reference' => '8d558bad69f1db256c80422ca245624512a2a47c',
17
17
  'type' => 'wordpress-plugin',
18
18
  'install_path' => __DIR__ . '/../../',
19
19
  'aliases' => array(),