Skip to content

Commit

Permalink
MU WPCOM: don't enqueue block scripts in the canvas iframe! (#41055)
Browse files Browse the repository at this point in the history
* MU WPCOM: don't enqueue block scripts in the canvas iframe

* changelog
  • Loading branch information
ellatrix authored Jan 19, 2025
1 parent ecf570b commit 8368291
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Performance fix


Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function () {
);

add_action(
is_admin() ? 'enqueue_block_assets' : 'enqueue_block_editor_assets',
'enqueue_block_editor_assets',
function () {
$handle = \jetpack_mu_wpcom_enqueue_assets( 'newspack-blocks-blog-posts-editor', array( 'js', 'css' ) );
enqueue_newspack_blocks_data( $handle );
Expand All @@ -112,7 +112,7 @@ function () {
);

add_action(
is_admin() ? 'enqueue_block_assets' : 'enqueue_block_editor_assets',
'enqueue_block_editor_assets',
function () {
$handle = \jetpack_mu_wpcom_enqueue_assets( 'newspack-blocks-carousel-editor', array( 'js', 'css' ) );
enqueue_newspack_blocks_data( $handle );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ function load_assets( $attr, $content ) {
function enqueue_block_editor_assets() {
\jetpack_mu_wpcom_enqueue_assets( 'wpcom-blocks-event-countdown-editor', array( 'js', 'css' ) );
}
if ( is_admin() ) {
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
} else {
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
}
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,4 @@ function load_assets( $attr, $content ) {
function enqueue_block_editor_assets() {
\jetpack_mu_wpcom_enqueue_assets( 'wpcom-blocks-timeline-editor', array( 'js', 'css' ) );
}
if ( is_admin() ) {
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
} else {
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
}
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_block_editor_assets' );
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Performance fix


5 changes: 5 additions & 0 deletions projects/plugins/wpcomsh/changelog/fix-block-asset-enqueueing
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Performance fix


0 comments on commit 8368291

Please sign in to comment.