Skip to content

Commit

Permalink
Merge pull request #211 from 10up/fix/update-api-version
Browse files Browse the repository at this point in the history
fix update apiVersion of block to version 3
  • Loading branch information
dkotter authored Aug 21, 2024
2 parents d687069 + 72f40b4 commit 3adbf91
Show file tree
Hide file tree
Showing 6 changed files with 1,289 additions and 1,357 deletions.
2 changes: 1 addition & 1 deletion block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title":"Apple Maps",
"category":"embed",
"description":"Add an Apple Map to your site.",
"apiVersion": 2,
"apiVersion": 3,
"keywords":[
"apple",
"map",
Expand Down
15 changes: 15 additions & 0 deletions includes/block-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ 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 to ensure that the mapkit js script gets properly loaded inside the editor iframe.
* It needs to be inside the iframe so the element we want to render the Map in is in the same window
* as the mapkit script. Otherwise mapkit will throw an error saying it cannot find the element.
*/
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.
Expand Down
Loading

0 comments on commit 3adbf91

Please sign in to comment.