Skip to content

Commit

Permalink
Remove _wpGutenbergCodeEditorSettings and wp.codeEditor assets (#11342)
Browse files Browse the repository at this point in the history
Remove _wpGutenbergCodeEditorSettings and the assets required to use
wp.codeEditor. Gutenberg no longer uses this as of cc5bf5c.
  • Loading branch information
noisysocks authored and aduth committed Nov 1, 2018
1 parent 20c7215 commit 1acf062
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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' );
Expand Down

0 comments on commit 1acf062

Please sign in to comment.