From 914c029ed2f4279b2269f92c23fc880edcacde5c Mon Sep 17 00:00:00 2001 From: Maxime BERNARD-JACQUET Date: Thu, 29 Nov 2018 13:59:05 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20enqueue=20dependencies=20?= =?UTF-8?q?for=20WP5.=20(#107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/01-single-block/src/init.php | 11 ++++++----- examples/02-single-block-ejected/src/init.php | 11 ++++++----- examples/03-multi-block/src/init.php | 11 ++++++----- examples/04-multi-block-ejected/src/init.php | 11 ++++++----- examples/05-a11y-input/src/init.php | 11 ++++++----- packages/cgb-scripts/template/src/init.php | 9 +++++---- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/examples/01-single-block/src/init.php b/examples/01-single-block/src/init.php index 054e0948..545debcf 100644 --- a/examples/01-single-block/src/init.php +++ b/examples/01-single-block/src/init.php @@ -16,7 +16,7 @@ /** * Enqueue Gutenberg block assets for both frontend + backend. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -25,7 +25,7 @@ function single_block_cgb_block_assets() { wp_enqueue_style( 'single_block-cgb-style-css', // Handle. plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS. - array( 'wp-blocks' ) // Dependency to include the CSS after it. + array( 'wp-editor' ) // Dependency to include the CSS after it. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime — Gets file modification time. ); } // End function single_block_cgb_block_assets(). @@ -36,9 +36,10 @@ function single_block_cgb_block_assets() { /** * Enqueue Gutenberg block assets for backend editor. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. - * `wp-i18n`: To internationalize the block's text. + * `wp-i18n`: internationalize the block's text. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -47,7 +48,7 @@ function single_block_cgb_editor_assets() { wp_enqueue_script( 'single_block-cgb-block-js', // Handle. plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack. - array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above. + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime — Gets file modification time. ); diff --git a/examples/02-single-block-ejected/src/init.php b/examples/02-single-block-ejected/src/init.php index 054e0948..545debcf 100644 --- a/examples/02-single-block-ejected/src/init.php +++ b/examples/02-single-block-ejected/src/init.php @@ -16,7 +16,7 @@ /** * Enqueue Gutenberg block assets for both frontend + backend. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -25,7 +25,7 @@ function single_block_cgb_block_assets() { wp_enqueue_style( 'single_block-cgb-style-css', // Handle. plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS. - array( 'wp-blocks' ) // Dependency to include the CSS after it. + array( 'wp-editor' ) // Dependency to include the CSS after it. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime — Gets file modification time. ); } // End function single_block_cgb_block_assets(). @@ -36,9 +36,10 @@ function single_block_cgb_block_assets() { /** * Enqueue Gutenberg block assets for backend editor. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. - * `wp-i18n`: To internationalize the block's text. + * `wp-i18n`: internationalize the block's text. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -47,7 +48,7 @@ function single_block_cgb_editor_assets() { wp_enqueue_script( 'single_block-cgb-block-js', // Handle. plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack. - array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above. + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime — Gets file modification time. ); diff --git a/examples/03-multi-block/src/init.php b/examples/03-multi-block/src/init.php index 81a83029..c2f96da5 100644 --- a/examples/03-multi-block/src/init.php +++ b/examples/03-multi-block/src/init.php @@ -16,7 +16,7 @@ /** * Enqueue Gutenberg block assets for both frontend + backend. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -25,7 +25,7 @@ function multi_block_cgb_block_assets() { wp_enqueue_style( 'multi_block-cgb-style-css', // Handle. plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS. - array( 'wp-blocks' ) // Dependency to include the CSS after it. + array( 'wp-editor' ) // Dependency to include the CSS after it. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime — Gets file modification time. ); } // End function multi_block_cgb_block_assets(). @@ -36,9 +36,10 @@ function multi_block_cgb_block_assets() { /** * Enqueue Gutenberg block assets for backend editor. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. - * `wp-i18n`: To internationalize the block's text. + * `wp-i18n`: internationalize the block's text. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -47,7 +48,7 @@ function multi_block_cgb_editor_assets() { wp_enqueue_script( 'multi_block-cgb-block-js', // Handle. plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack. - array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above. + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime — Gets file modification time. ); diff --git a/examples/04-multi-block-ejected/src/init.php b/examples/04-multi-block-ejected/src/init.php index 81a83029..c2f96da5 100644 --- a/examples/04-multi-block-ejected/src/init.php +++ b/examples/04-multi-block-ejected/src/init.php @@ -16,7 +16,7 @@ /** * Enqueue Gutenberg block assets for both frontend + backend. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -25,7 +25,7 @@ function multi_block_cgb_block_assets() { wp_enqueue_style( 'multi_block-cgb-style-css', // Handle. plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS. - array( 'wp-blocks' ) // Dependency to include the CSS after it. + array( 'wp-editor' ) // Dependency to include the CSS after it. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime — Gets file modification time. ); } // End function multi_block_cgb_block_assets(). @@ -36,9 +36,10 @@ function multi_block_cgb_block_assets() { /** * Enqueue Gutenberg block assets for backend editor. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. - * `wp-i18n`: To internationalize the block's text. + * `wp-i18n`: internationalize the block's text. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -47,7 +48,7 @@ function multi_block_cgb_editor_assets() { wp_enqueue_script( 'multi_block-cgb-block-js', // Handle. plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack. - array( 'wp-blocks', 'wp-i18n', 'wp-element' ) // Dependencies, defined above. + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ) // Dependencies, defined above. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ) // Version: filemtime — Gets file modification time. ); diff --git a/examples/05-a11y-input/src/init.php b/examples/05-a11y-input/src/init.php index 0064159f..8d97f7f0 100644 --- a/examples/05-a11y-input/src/init.php +++ b/examples/05-a11y-input/src/init.php @@ -16,7 +16,7 @@ /** * Enqueue Gutenberg block assets for both frontend + backend. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -25,7 +25,7 @@ function a11y_input_cgb_block_assets() { wp_enqueue_style( 'a11y_input-cgb-style-css', // Handle. plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS. - array( 'wp-blocks' ) // Dependency to include the CSS after it. + array( 'wp-editor' ) // Dependency to include the CSS after it. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime — Gets file modification time. ); } // End function a11y_input_cgb_block_assets(). @@ -36,9 +36,10 @@ function a11y_input_cgb_block_assets() { /** * Enqueue Gutenberg block assets for backend editor. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. - * `wp-i18n`: To internationalize the block's text. + * `wp-i18n`: internationalize the block's text. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -47,7 +48,7 @@ function a11y_input_cgb_editor_assets() { wp_enqueue_script( 'a11y_input-cgb-block-js', // Handle. plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack. - array( 'wp-blocks', 'wp-i18n', 'wp-element' ), // Dependencies, defined above. + array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ), // Dependencies, defined above. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: filemtime — Gets file modification time. true // Enqueue the script in the footer. ); diff --git a/packages/cgb-scripts/template/src/init.php b/packages/cgb-scripts/template/src/init.php index cff34020..7de18cd6 100644 --- a/packages/cgb-scripts/template/src/init.php +++ b/packages/cgb-scripts/template/src/init.php @@ -16,7 +16,7 @@ /** * Enqueue Gutenberg block assets for both frontend + backend. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */ @@ -25,7 +25,7 @@ function <% blockNamePHPLower %>_cgb_block_assets() { wp_enqueue_style( '<% blockNamePHPLower %>-cgb-style-css', // Handle. plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS. - array( 'wp-blocks' ) // Dependency to include the CSS after it. + array( 'wp-editor' ) // Dependency to include the CSS after it. // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: filemtime — Gets file modification time. ); } // End function <% blockNamePHPLower %>_cgb_block_assets(). @@ -36,9 +36,10 @@ function <% blockNamePHPLower %>_cgb_block_assets() { /** * Enqueue Gutenberg block assets for backend editor. * - * `wp-blocks`: includes block type registration and related functions. + * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. - * `wp-i18n`: To internationalize the block's text. + * `wp-i18n`: internationalize the block's text. + * `wp-editor`: WP editor styles. * * @since 1.0.0 */