@@ -55,11 +55,6 @@ abstract class Renderer implements RenderingInterface, Iterator {
55
55
*/
56
56
public const STYLE_HANDLE = 'web-stories-list-styles ' ;
57
57
58
- /**
59
- * Web Stories stylesheet handle.
60
- */
61
- public const LIGHTBOX_SCRIPT_HANDLE = 'web-stories-lightbox ' ;
62
-
63
58
/**
64
59
* Number of instances invoked. Kept it static to keep track.
65
60
*/
@@ -277,9 +272,6 @@ public function load_assets(): void {
277
272
// Web Stories styles for AMP and non-AMP pages.
278
273
$ this ->assets ->register_style_asset ( self ::STYLE_HANDLE );
279
274
280
- // Web Stories lightbox script.
281
- $ this ->assets ->register_script_asset ( self ::LIGHTBOX_SCRIPT_HANDLE , [ AMP_Story_Player_Assets::SCRIPT_HANDLE ] );
282
-
283
275
if ( \defined ( 'AMPFORWP_VERSION ' ) ) {
284
276
add_action ( 'amp_post_template_css ' , [ $ this , 'add_amp_post_template_css ' ] );
285
277
}
@@ -377,9 +369,21 @@ class="<?php echo esc_attr( $single_story_classes ); ?>"
377
369
} else {
378
370
$ this ->assets ->enqueue_style ( AMP_Story_Player_Assets::SCRIPT_HANDLE );
379
371
$ this ->assets ->enqueue_script ( AMP_Story_Player_Assets::SCRIPT_HANDLE );
380
- $ this ->assets ->enqueue_script_asset ( self ::LIGHTBOX_SCRIPT_HANDLE );
381
372
?>
382
- <div class="<?php echo esc_attr ( $ single_story_classes ); ?> ">
373
+ <div
374
+ class="<?php echo esc_attr ( $ single_story_classes ); ?> "
375
+ data-wp-interactive="web-stories-block"
376
+ <?php
377
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
378
+ echo wp_interactivity_data_wp_context (
379
+ [
380
+ 'instanceId ' => $ this ->instance_id ,
381
+ ]
382
+ );
383
+ ?>
384
+ data-wp-on--click="actions.open"
385
+ data-wp-on-window--popstate="actions.onPopstate"
386
+ >
383
387
<?php $ this ->render_story_with_poster (); ?>
384
388
</div>
385
389
<?php
@@ -410,7 +414,14 @@ public function render_stories_with_lightbox(): void {
410
414
];
411
415
?>
412
416
<div class="web-stories-list__lightbox">
413
- <amp-story-player width="3.6" height="6" layout="responsive">
417
+ <amp-story-player
418
+ width="3.6"
419
+ height="6"
420
+ layout="responsive"
421
+ data-wp-interactive="web-stories-block"
422
+ data-wp-on--amp-story-player-close="actions.close"
423
+ data-wp-on--navigation="actions.navigation"
424
+ >
414
425
<script type="application/json">
415
426
<?php echo wp_json_encode ( $ data ); ?>
416
427
</script>
@@ -832,6 +843,9 @@ class="story-lightbox__close-button"
832
843
width="3.6"
833
844
height="6"
834
845
layout="responsive"
846
+ data-wp-interactive="web-stories-block"
847
+ data-wp-on--amp-story-player-close="actions.close"
848
+ data-wp-on--navigation="actions.navigation"
835
849
>
836
850
<a href="<?php echo esc_url ( $ story ->get_url () ); ?> " <?php $ this ->render_link_attributes (); ?> ><?php echo esc_html ( $ story ->get_title () ); ?> </a>
837
851
</amp-story-player>
0 commit comments