Skip to content

Commit

Permalink
Plugin: Deprecate window._wpLoadGutenbergEditor (#13547)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored Jan 29, 2019
1 parent 5f2c25d commit 4165bbd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The Gutenberg project's deprecation policy is intended to support backward compa
- The PHP function `gutenberg_meta_box_post_form_hidden_fields` has been removed. Use [`the_block_editor_meta_box_post_form_hidden_fields`](https://developer.wordpress.org/reference/functions/the_block_editor_meta_box_post_form_hidden_fields/) instead.
- The PHP function `gutenberg_toggle_custom_fields` has been removed.
- The PHP function `gutenberg_collect_meta_box_data` has been removed. Use [`register_and_do_post_meta_boxes`](https://developer.wordpress.org/reference/functions/register_and_do_post_meta_boxes/) instead.
- `window._wpLoadGutenbergEditor` has been removed. Use `window._wpLoadBlockEditor` instead. Note: This is a private API, not intended for public use. It may be removed in the future.

## 4.5.0
- `Dropdown.refresh()` has been deprecated as the contained `Popover` is now automatically refreshed.
Expand Down
18 changes: 17 additions & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1208,11 +1208,27 @@ function gutenberg_editor_scripts_and_styles( $hook ) {

$init_script = <<<JS
( function() {
window._wpLoadGutenbergEditor = window._wpLoadBlockEditor = new Promise( function( resolve ) {
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;
}
} );
} )();
JS;

Expand Down

0 comments on commit 4165bbd

Please sign in to comment.