Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix update apiVersion of block to version 3 #211

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading