@@ -55,11 +55,6 @@ abstract class Renderer implements RenderingInterface, Iterator {
5555 */
5656 public const STYLE_HANDLE = 'web-stories-list-styles ' ;
5757
58- /**
59- * Web Stories stylesheet handle.
60- */
61- public const LIGHTBOX_SCRIPT_HANDLE = 'web-stories-lightbox ' ;
62-
6358 /**
6459 * Number of instances invoked. Kept it static to keep track.
6560 */
@@ -277,9 +272,6 @@ public function load_assets(): void {
277272 // Web Stories styles for AMP and non-AMP pages.
278273 $ this ->assets ->register_style_asset ( self ::STYLE_HANDLE );
279274
280- // Web Stories lightbox script.
281- $ this ->assets ->register_script_asset ( self ::LIGHTBOX_SCRIPT_HANDLE , [ AMP_Story_Player_Assets::SCRIPT_HANDLE ] );
282-
283275 if ( \defined ( 'AMPFORWP_VERSION ' ) ) {
284276 add_action ( 'amp_post_template_css ' , [ $ this , 'add_amp_post_template_css ' ] );
285277 }
@@ -377,9 +369,21 @@ class="<?php echo esc_attr( $single_story_classes ); ?>"
377369 } else {
378370 $ this ->assets ->enqueue_style ( AMP_Story_Player_Assets::SCRIPT_HANDLE );
379371 $ this ->assets ->enqueue_script ( AMP_Story_Player_Assets::SCRIPT_HANDLE );
380- $ this ->assets ->enqueue_script_asset ( self ::LIGHTBOX_SCRIPT_HANDLE );
381372 ?>
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+ >
383387 <?php $ this ->render_story_with_poster (); ?>
384388 </div>
385389 <?php
@@ -410,7 +414,14 @@ public function render_stories_with_lightbox(): void {
410414 ];
411415 ?>
412416 <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+ >
414425 <script type="application/json">
415426 <?php echo wp_json_encode ( $ data ); ?>
416427 </script>
@@ -832,6 +843,9 @@ class="story-lightbox__close-button"
832843 width="3.6"
833844 height="6"
834845 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"
835849 >
836850 <a href="<?php echo esc_url ( $ story ->get_url () ); ?> " <?php $ this ->render_link_attributes (); ?> ><?php echo esc_html ( $ story ->get_title () ); ?> </a>
837851 </amp-story-player>
0 commit comments