From 40920e9cf847334fec205646528c85614afca0f5 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 4 May 2018 15:33:03 +0100 Subject: [PATCH] Ensure the editor module is loaded before third party plugins --- lib/client-assets.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/client-assets.php b/lib/client-assets.php index 06a60de0fdd824..a9d8792db32fe1 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -289,8 +289,7 @@ function gutenberg_register_scripts_and_styles() { 'tinymce-latest-paste', 'tinymce-latest-table', ), - filemtime( gutenberg_dir_path() . 'editor/build/index.js' ), - true + filemtime( gutenberg_dir_path() . 'editor/build/index.js' ) ); wp_register_script( @@ -1017,3 +1016,14 @@ function gutenberg_editor_scripts_and_styles( $hook ) { */ do_action( 'enqueue_block_editor_assets' ); } + +/** + * Ensure the editor module is loaded before third party plugins. + * + * Remove this in Gutenberg 3.1 + */ +function polyfill_blocks_module_in_scripts() { + wp_enqueue_script( 'wp-editor' ); +} + +add_action( 'enqueue_block_editor_assets', 'polyfill_blocks_module_in_scripts', 9 );