Skip to content

Commit

Permalink
Plugin: Remove deprecated _wpLoadGutenbergEditor, gutenberg theme…
Browse files Browse the repository at this point in the history
… supports (#14144)

* Plugin: Remove deprecated `gutenberg` theme supports
* Plugin: Remove deprecated `_wpLoadGutenbergEditor`
  • Loading branch information
aduth authored and youknowriad committed Mar 6, 2019
1 parent a6f30dc commit 58d9ed8
Showing 1 changed file with 9 additions and 31 deletions.
40 changes: 9 additions & 31 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,9 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
wp_localize_script( 'wp-editor', '_wpMetaBoxUrl', $meta_box_url );

// Initialize the editor.
$gutenberg_theme_support = get_theme_support( 'gutenberg' );
$align_wide = get_theme_support( 'align-wide' );
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );

if ( ! empty( $gutenberg_theme_support ) ) {
wp_enqueue_script( 'wp-deprecated' );
wp_add_inline_script( 'wp-deprecated', 'wp.deprecated( "`gutenberg` theme support", { plugin: "Gutenberg", version: "5.2", alternative: "`align-wide` theme support" } );' );
}
$align_wide = get_theme_support( 'align-wide' );
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );

/**
* Filters the allowed block types for the editor, defaulting to true (all
Expand Down Expand Up @@ -879,7 +873,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
}

$editor_settings = array(
'alignWide' => $align_wide || ! empty( $gutenberg_theme_support[0]['wide-images'] ), // Backcompat. Use `align-wide` outside of `gutenberg` array.
'alignWide' => $align_wide,
'availableTemplates' => $available_templates,
'allowedBlockTypes' => $allowed_block_types,
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
Expand Down Expand Up @@ -952,28 +946,12 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
$editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post );

$init_script = <<<JS
( function() {
window._wpLoadBlockEditor = new Promise( function( resolve ) {
wp.domReady( function() {
resolve( wp.editPost.initializeEditor( 'editor', "%s", %d, %s, %s ) );
} );
} );
Object.defineProperty( window, '_wpLoadGutenbergEditor', {
get: function() {
// TODO: Hello future maintainer. In removing this deprecation,
// ensure also to check whether `wp-editor`'s dependencies in
// `package-dependencies.php` still require `wp-deprecated`.
wp.deprecated( '`window._wpLoadGutenbergEditor`', {
plugin: 'Gutenberg',
version: '5.2',
alternative: '`window._wpLoadBlockEditor`',
hint: 'This is a private API, not intended for public use. It may be removed in the future.'
} );
return window._wpLoadBlockEditor;
}
( function() {
window._wpLoadBlockEditor = new Promise( function( resolve ) {
wp.domReady( function() {
resolve( wp.editPost.initializeEditor( 'editor', "%s", %d, %s, %s ) );
} );
} );
} )();
JS;

Expand Down

0 comments on commit 58d9ed8

Please sign in to comment.