From 1acf0626c097e2c2400d7acca6f9f161e4dff744 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 1 Nov 2018 23:59:21 +1100 Subject: [PATCH] Remove _wpGutenbergCodeEditorSettings and wp.codeEditor assets (#11342) Remove _wpGutenbergCodeEditorSettings and the assets required to use wp.codeEditor. Gutenberg no longer uses this as of cc5bf5c. --- lib/client-assets.php | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/lib/client-assets.php b/lib/client-assets.php index c34e03edc7d5f1..b68c2fa5c99036 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -1239,32 +1239,6 @@ function gutenberg_default_post_format_template( $settings, $post ) { } add_filter( 'block_editor_settings', 'gutenberg_default_post_format_template', 10, 2 ); -/** - * The code editor settings that were last captured by - * gutenberg_capture_code_editor_settings(). - * - * @var array|false - */ -$gutenberg_captured_code_editor_settings = false; - -/** - * When passed to the wp_code_editor_settings filter, this function captures - * the code editor settings given to it and then prevents - * wp_enqueue_code_editor() from enqueuing any assets. - * - * This is a workaround until e.g. code_editor_settings() is added to Core. - * - * @since 2.1.0 - * - * @param array $settings Code editor settings. - * @return false - */ -function gutenberg_capture_code_editor_settings( $settings ) { - global $gutenberg_captured_code_editor_settings; - $gutenberg_captured_code_editor_settings = $settings; - return false; -} - /** * Retrieve a stored autosave that is newer than the post save. * @@ -1509,19 +1483,6 @@ function gutenberg_editor_scripts_and_styles( $hook ) { ); wp_localize_script( 'wp-editor', '_wpMetaBoxUrl', $meta_box_url ); - // Populate default code editor settings by short-circuiting wp_enqueue_code_editor. - global $gutenberg_captured_code_editor_settings; - add_filter( 'wp_code_editor_settings', 'gutenberg_capture_code_editor_settings' ); - wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); - remove_filter( 'wp_code_editor_settings', 'gutenberg_capture_code_editor_settings' ); - wp_add_inline_script( - 'wp-editor', - sprintf( - 'window._wpGutenbergCodeEditorSettings = %s;', - wp_json_encode( $gutenberg_captured_code_editor_settings ) - ) - ); - // Initialize the editor. $gutenberg_theme_support = get_theme_support( 'gutenberg' ); $align_wide = get_theme_support( 'align-wide' );