From 655f8029e388dd0327497f61d3cc9e476db78714 Mon Sep 17 00:00:00 2001 From: wadebekker Date: Wed, 21 Aug 2024 14:47:09 +0200 Subject: [PATCH] Load apple-mapkit-js script within the editor iframe --- includes/block-assets.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/block-assets.php b/includes/block-assets.php index 2f6269e..1843252 100644 --- a/includes/block-assets.php +++ b/includes/block-assets.php @@ -78,6 +78,20 @@ function register_block_assets() { } +add_action( 'enqueue_block_assets', __NAMESPACE__ . '\load_apple_map_script_in_iframe' ); +/** + * Load Apple MapKit script within the editor iframe. + * This is required in order to target the correct DOM node within the iframe + * and apply the Mapkit script to it. + */ +function load_apple_map_script_in_iframe() { + if ( !is_admin() ) { + return; + } + + wp_enqueue_script( 'apple-mapkit-js' ); +} + add_action( 'init', __NAMESPACE__ . '\set_script_translations' ); /** * Load translations.