diff --git a/packages/block-library/src/file/index.php b/packages/block-library/src/file/index.php index 24eaff8bac622..06eb10cf1d895 100644 --- a/packages/block-library/src/file/index.php +++ b/packages/block-library/src/file/index.php @@ -38,7 +38,7 @@ static function ( $matches ) { // If it's interactive, enqueue the script module and add the directives. if ( ! empty( $attributes['displayPreview'] ) ) { - wp_enqueue_script_module( '@wordpress/block-library/file-block' ); + wp_enqueue_script_module( '@wordpress/block-library/file' ); $processor = new WP_HTML_Tag_Processor( $content ); $processor->next_tag(); @@ -64,8 +64,8 @@ function register_block_core_file() { ); wp_register_script_module( - '@wordpress/block-library/file-block', - gutenberg_url( '/build/interactivity/file.min.js' ), + '@wordpress/block-library/file', + defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/file.min.js' ) : includes_url( 'blocks/file/view.min.js' ), array( '@wordpress/interactivity' ), defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) ); diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php index 3297c57d9eab3..f926890c1a3fc 100644 --- a/packages/block-library/src/image/index.php +++ b/packages/block-library/src/image/index.php @@ -325,7 +325,7 @@ function register_block_core_image() { wp_register_script_module( '@wordpress/block-library/image', - gutenberg_url( '/build/interactivity/image.min.js' ), + defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/image.min.js' ) : includes_url( 'blocks/image/view.min.js' ), array( '@wordpress/interactivity' ), defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) ); diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 0f67a63e7acf2..a0672a0bed580 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -567,7 +567,7 @@ private static function get_nav_element_directives( $is_interactive, $attributes */ private static function handle_view_script_module_loading( $attributes, $block, $inner_blocks ) { if ( static::is_interactive( $attributes, $inner_blocks ) ) { - wp_enqueue_script_module( '@wordpress/block-library/navigation-block' ); + wp_enqueue_script_module( '@wordpress/block-library/navigation' ); } } @@ -1081,8 +1081,8 @@ function register_block_core_navigation() { ); wp_register_script_module( - '@wordpress/block-library/navigation-block', - gutenberg_url( '/build/interactivity/navigation.min.js' ), + '@wordpress/block-library/navigation', + defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/navigation.min.js' ) : includes_url( 'blocks/navigation/view.min.js' ), array( '@wordpress/interactivity' ), defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) ); diff --git a/packages/block-library/src/query/index.php b/packages/block-library/src/query/index.php index 5d509607a7dc8..e21601b171187 100644 --- a/packages/block-library/src/query/index.php +++ b/packages/block-library/src/query/index.php @@ -101,7 +101,7 @@ function register_block_core_query() { wp_register_script_module( '@wordpress/block-library/query', - gutenberg_url( '/build/interactivity/query.min.js' ), + defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/query.min.js' ) : includes_url( 'blocks/query/view.min.js' ), array( array( 'id' => '@wordpress/interactivity', diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php index 266eb93ca82a4..ce4277601937b 100644 --- a/packages/block-library/src/search/index.php +++ b/packages/block-library/src/search/index.php @@ -80,7 +80,7 @@ function render_block_core_search( $attributes ) { // If it's interactive, enqueue the script module and add the directives. $is_expandable_searchfield = 'button-only' === $button_position; if ( $is_expandable_searchfield ) { - wp_enqueue_script_module( '@wordpress/block-library/search-block' ); + wp_enqueue_script_module( '@wordpress/block-library/search' ); $input->set_attribute( 'data-wp-bind--aria-hidden', '!context.isSearchInputVisible' ); $input->set_attribute( 'data-wp-bind--tabindex', 'state.tabindex' ); @@ -198,8 +198,8 @@ function register_block_core_search() { ); wp_register_script_module( - '@wordpress/block-library/search-block', - gutenberg_url( '/build/interactivity/search.min.js' ), + '@wordpress/block-library/search', + defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ? gutenberg_url( '/build/interactivity/search.min.js' ) : includes_url( 'blocks/search/view.min.js' ), array( '@wordpress/interactivity' ), defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) );