mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-11 14:22:26 +01:00
Widgets: Stop loading wp-editor
and the Block Directory assets on the widgets screen.
When using the text widget, a `wp.editor.initialize is not a function` notice is encountered. This happens when `wp-editor` is loaded as a dependency, which assigns `wp.oldEditor = wp.editor` and then redefines `wp.editor`. `wp-editor` is only used for the Classic block, which is not supported in the new widgets editor. [51198-51199] updated `@wordpress/block-library` to remove `wp-editor` as a dependency, but it’s still listed as a dependency of the `wp-block-directory` script handle. Since the Block directory is not supported within the widgets editor, the related assets can safely be blocked from enqueueing. Props noisysocks, gziolo, Mamaduka, mkaz. Fixes #53437. See #53397. Built from https://develop.svn.wordpress.org/trunk@51202 git-svn-id: http://core.svn.wordpress.org/trunk@50811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8a11188d0f
commit
b32d8c1bf6
@ -29,6 +29,11 @@ $editor_settings = get_block_editor_settings(
|
||||
$block_editor_context
|
||||
);
|
||||
|
||||
// The widgets editor does not support the Block Directory, so don't load any of
|
||||
// its assets. This also prevents 'wp-editor' from being enqueued which we
|
||||
// cannot load in the widgets screen because many widget scripts rely on `wp.editor`.
|
||||
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
|
||||
|
||||
wp_add_inline_script(
|
||||
'wp-edit-widgets',
|
||||
sprintf(
|
||||
@ -67,7 +72,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
do_action( 'widgets_admin_page' );
|
||||
?>
|
||||
|
||||
<div id="widgets-editor" class="blocks-widgets-container"></div>
|
||||
<div id="widgets-editor" class="blocks-widgets-container"></div>
|
||||
|
||||
<?php
|
||||
/** This action is documented in wp-admin/widgets-form.php */
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-beta2-51201';
|
||||
$wp_version = '5.8-beta2-51202';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user