Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9

- First pass at adding the site editor from the Gutenberg plugin to
  wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.


git-svn-id: https://develop.svn.wordpress.org/trunk@52069 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Robert Anderson
2021-11-09 02:15:23 +00:00
parent ecf1d6a158
commit f034bc832e
59 changed files with 4240 additions and 168 deletions

View File

@@ -103,8 +103,8 @@ function wp_default_packages_vendor( $scripts ) {
);
$vendor_scripts_versions = array(
'react' => '16.13.1',
'react-dom' => '16.13.1',
'react' => '17.0.1',
'react-dom' => '17.0.1',
'regenerator-runtime' => '0.13.7',
'moment' => '2.29.1',
'lodash' => '4.17.19',
@@ -1598,6 +1598,11 @@ function wp_default_styles( $styles ) {
'wp-block-library',
'wp-reusable-blocks',
),
'edit-site' => array(
'wp-components',
'wp-block-editor',
'wp-edit-blocks',
),
);
foreach ( $package_styles as $package => $dependencies ) {
@@ -1655,6 +1660,7 @@ function wp_default_styles( $styles ) {
'wp-components',
'wp-customize-widgets',
'wp-edit-post',
'wp-edit-site',
'wp-edit-widgets',
'wp-editor',
'wp-format-library',
@@ -2265,7 +2271,19 @@ function wp_common_block_scripts_and_styles() {
wp_enqueue_style( 'wp-block-library' );
if ( current_theme_supports( 'wp-block-styles' ) ) {
wp_enqueue_style( 'wp-block-library-theme' );
if ( wp_should_load_separate_core_block_assets() ) {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? 'css' : 'min.css';
$files = glob( __DIR__ . "/blocks/**/theme.$suffix" );
foreach ( $files as $path ) {
$block_name = basename( dirname( $path ) );
if ( is_rtl() && file_exists( __DIR__ . "/blocks/$block_name/theme-rtl.$suffix" ) ) {
$path = __DIR__ . "/blocks/$block_name/theme-rtl.$suffix";
}
wp_add_inline_style( "wp-block-{$block_name}", file_get_contents( $path ) );
}
} else {
wp_enqueue_style( 'wp-block-library-theme' );
}
}
/**
@@ -2773,6 +2791,8 @@ function _wp_normalize_relative_css_links( $css, $stylesheet_url ) {
* @since 5.8.0
*/
function wp_add_iframed_editor_assets_html() {
global $pagenow;
if ( ! wp_should_load_block_editor_scripts_and_styles() ) {
return;
}
@@ -2785,6 +2805,11 @@ function wp_add_iframed_editor_assets_html() {
'wp-edit-blocks',
);
if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) {
$style_handles[] = 'wp-widgets';
$style_handles[] = 'wp-edit-widgets';
}
$block_registry = WP_Block_Type_Registry::get_instance();
foreach ( $block_registry->get_all_registered() as $block_type ) {
@@ -2806,7 +2831,8 @@ function wp_add_iframed_editor_assets_html() {
ob_start();
wp_styles()->done = array();
// We do not need reset styles for the iframed editor.
wp_styles()->done = array( 'wp-reset-editor-styles' );
wp_styles()->do_items( $style_handles );
wp_styles()->done = $done;