From 13da68ad4ef12f2f6cf7eace2ca225f400a6d494 Mon Sep 17 00:00:00 2001 From: Luis Herranz Date: Tue, 27 Sep 2022 18:26:44 +0200 Subject: [PATCH] Try renaming the view file (unsucessful) --- packages/block-library/src/navigation/block.json | 2 +- packages/block-library/src/navigation/index.php | 10 +++------- .../navigation/{view.js => wordpress-directives.js} | 0 3 files changed, 4 insertions(+), 8 deletions(-) rename packages/block-library/src/navigation/{view.js => wordpress-directives.js} (100%) diff --git a/packages/block-library/src/navigation/block.json b/packages/block-library/src/navigation/block.json index 781251b101aa8d..3bb6ab8911cb7b 100644 --- a/packages/block-library/src/navigation/block.json +++ b/packages/block-library/src/navigation/block.json @@ -130,7 +130,7 @@ } } }, - "viewScript": [ "file:./view.min.js" ], + "viewScript": [ "file:./wordpress-directives.min.js" ], "editorStyle": "wp-block-navigation-editor", "style": "wp-block-navigation" } diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index cb41d2195b6af6..0a2d2fe532c779 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -421,14 +421,10 @@ function render_block_core_navigation( $attributes, $content, $block ) { */ $has_old_responsive_attribute = ! empty( $attributes['isResponsive'] ) && $attributes['isResponsive']; $is_responsive_menu = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'] || $has_old_responsive_attribute; - $should_load_view_script = ! wp_script_is( 'wp-block-navigation-view' ) && ( $is_responsive_menu || $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ); - if ( $should_load_view_script ) { - wp_enqueue_script( 'wp-block-navigation-view' ); - } - $should_load_modal_view_script = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu']; - if ( $should_load_modal_view_script ) { - wp_enqueue_script( 'wp-block-navigation-view-modal' ); + $should_load_view_script = ! wp_script_is( 'wp-block-navigation-wordpress-directives' ) && ( $is_responsive_menu || $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ); + if ( $should_load_view_script ) { + wp_enqueue_script( 'wp-block-navigation-wordpress-directives' ); } $inner_blocks = $block->inner_blocks; diff --git a/packages/block-library/src/navigation/view.js b/packages/block-library/src/navigation/wordpress-directives.js similarity index 100% rename from packages/block-library/src/navigation/view.js rename to packages/block-library/src/navigation/wordpress-directives.js