Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @wordpress packages #1928

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
499 changes: 273 additions & 226 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Expand Up @@ -29,7 +29,7 @@
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
"@wordpress/e2e-test-utils": "5.4.8",
"@wordpress/library-export-default-webpack-plugin": "2.2.0",
"@wordpress/scripts": "19.2.1",
"@wordpress/scripts": "19.2.2",
"autoprefixer": "^9.8.8",
"chalk": "4.1.2",
"check-node-version": "4.1.0",
Expand Down Expand Up @@ -82,53 +82,53 @@
"@wordpress/api-fetch": "5.2.6",
"@wordpress/autop": "3.2.3",
"@wordpress/blob": "3.2.2",
"@wordpress/block-directory": "3.0.9",
"@wordpress/block-editor": "8.0.3",
"@wordpress/block-library": "6.0.7",
"@wordpress/block-directory": "3.0.11",
"@wordpress/block-editor": "8.0.5",
"@wordpress/block-library": "6.0.9",
"@wordpress/block-serialization-default-parser": "4.2.3",
"@wordpress/blocks": "11.1.4",
"@wordpress/components": "19.0.3",
"@wordpress/components": "19.0.5",
"@wordpress/compose": "5.0.6",
"@wordpress/core-data": "4.0.7",
"@wordpress/customize-widgets": "2.0.9",
"@wordpress/customize-widgets": "2.0.11",
"@wordpress/data": "6.1.4",
"@wordpress/data-controls": "2.2.7",
"@wordpress/date": "4.2.3",
"@wordpress/deprecated": "3.2.3",
"@wordpress/dom": "3.2.7",
"@wordpress/dom-ready": "3.2.3",
"@wordpress/edit-post": "5.0.9",
"@wordpress/edit-site": "3.0.9",
"@wordpress/edit-widgets": "3.1.4",
"@wordpress/editor": "12.0.6",
"@wordpress/edit-post": "5.0.11",
"@wordpress/edit-site": "3.0.11",
"@wordpress/edit-widgets": "3.1.6",
"@wordpress/editor": "12.0.8",
"@wordpress/element": "4.0.4",
"@wordpress/escape-html": "2.2.3",
"@wordpress/format-library": "3.0.9",
"@wordpress/format-library": "3.0.11",
"@wordpress/hooks": "3.2.2",
"@wordpress/html-entities": "3.2.3",
"@wordpress/i18n": "4.2.4",
"@wordpress/icons": "6.1.1",
"@wordpress/interface": "4.1.5",
"@wordpress/interface": "4.1.7",
"@wordpress/is-shallow-equal": "4.2.1",
"@wordpress/keyboard-shortcuts": "3.0.6",
"@wordpress/keycodes": "3.2.4",
"@wordpress/list-reusable-blocks": "3.0.7",
"@wordpress/list-reusable-blocks": "3.0.9",
"@wordpress/media-utils": "3.0.5",
"@wordpress/notices": "3.2.7",
"@wordpress/nux": "5.0.7",
"@wordpress/nux": "5.0.9",
"@wordpress/plugins": "4.0.6",
"@wordpress/primitives": "3.0.4",
"@wordpress/priority-queue": "2.2.3",
"@wordpress/redux-routine": "4.2.2",
"@wordpress/reusable-blocks": "3.0.9",
"@wordpress/reusable-blocks": "3.0.11",
"@wordpress/rich-text": "5.0.6",
"@wordpress/server-side-render": "3.0.7",
"@wordpress/server-side-render": "3.0.9",
"@wordpress/shortcode": "3.2.3",
"@wordpress/token-list": "2.2.2",
"@wordpress/url": "3.3.1",
"@wordpress/viewport": "4.0.6",
"@wordpress/warning": "2.2.2",
"@wordpress/widgets": "2.0.9",
"@wordpress/widgets": "2.0.11",
"@wordpress/wordcount": "3.2.3",
"backbone": "1.4.0",
"clipboard": "2.0.8",
Expand Down
21 changes: 11 additions & 10 deletions src/wp-admin/menu.php
Expand Up @@ -212,19 +212,13 @@
'edit_theme_options',
'site-editor.php',
);

$submenu['themes.php'][7] = array(
__( 'Styles' ),
'edit_theme_options',
'site-editor.php?styles=open',
);
}

// Hide Customize link on block themes unless a plugin or theme is using
// customize_register to add a setting.
if ( ! wp_is_block_template_theme() || has_action( 'customize_register' ) ) {
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
$position = wp_is_block_template_theme() ? 8 : 6;
$position = wp_is_block_template_theme() ? 7 : 6;

$submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
}
Expand All @@ -249,17 +243,24 @@

// Add 'Theme Editor' to the bottom of the Appearance menu.
if ( ! is_multisite() ) {
// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook.
add_action( 'admin_menu', '_add_themes_utility_last', 101 );
}
/**
* Adds the 'Theme Editor' link to the bottom of the Appearance menu.
* Adds the 'Theme Editor' link to the bottom of the Appearance or Tools menu.
*
* @access private
* @since 3.0.0
* @since 5.9.0 'Theme Editor' link has moved to the Tools menu when a block theme is active.
*/
function _add_themes_utility_last() {
// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook.
add_submenu_page( 'themes.php', __( 'Theme Editor' ), __( 'Theme Editor' ), 'edit_themes', 'theme-editor.php' );
add_submenu_page(
wp_is_block_template_theme() ? 'tools.php' : 'themes.php',
__( 'Theme Editor' ),
__( 'Theme Editor' ),
'edit_themes',
'theme-editor.php'
);
}

$count = '';
Expand Down
127 changes: 78 additions & 49 deletions src/wp-admin/site-editor.php
Expand Up @@ -40,60 +40,89 @@ static function( $classes ) {
);

$block_editor_context = new WP_Block_Editor_Context();

$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
$active_theme = wp_get_theme()->get_stylesheet();
$preload_paths = array(
array( '/wp/v2/media', 'OPTIONS' ),
'/',
'/wp/v2/types?context=edit',
'/wp/v2/taxonomies?context=edit',
'/wp/v2/pages?context=edit',
'/wp/v2/categories?context=edit',
'/wp/v2/posts?context=edit',
'/wp/v2/tags?context=edit',
'/wp/v2/templates?context=edit',
'/wp/v2/template-parts?context=edit',
'/wp/v2/settings',
'/wp/v2/themes?context=edit&status=active',
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
'/wp/v2/global-styles/' . $active_global_styles_id,
'/wp/v2/themes/' . $active_theme . '/global-styles',
'/wp/v2/block-navigation-areas?context=edit',
$custom_settings = array(
'siteUrl' => site_url(),
'postsPerPage' => get_option( 'posts_per_page' ),
'styles' => get_block_editor_theme_styles(),
'defaultTemplateTypes' => get_default_block_template_types(),
'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(),
'__experimentalBlockPatterns' => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
'__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
);
$editor_settings = get_block_editor_settings( $custom_settings, $block_editor_context );

if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {

$post_type = get_post_type_object( $_GET['postType'] );

$areas = get_option( 'wp_navigation_areas', array() );
$active_areas = array_intersect_key( $areas, get_navigation_areas() );
foreach ( $active_areas as $post_id ) {
if ( $post_id ) {
$preload_paths[] = add_query_arg( 'context', 'edit', rest_get_route_for_post( $post_id ) );
if ( ! $post_type ) {
wp_die( __( 'Invalid post type.' ) );
}
}

block_editor_rest_api_preload( $preload_paths, $block_editor_context );

$editor_settings = get_block_editor_settings(
array(
'siteUrl' => site_url(),
'postsPerPage' => get_option( 'posts_per_page' ),
'styles' => get_block_editor_theme_styles(),
'defaultTemplateTypes' => get_default_block_template_types(),
'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(),
'__experimentalBlockPatterns' => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
'__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
),
$block_editor_context
);
$preload_paths = array(
'/',
'/wp/v2/types/' . $post_type->name . '?context=edit',
'/wp/v2/types?context=edit',
'/wp/v2/' . $post_type->rest_base . '?context=edit',
);

wp_add_inline_script(
'wp-edit-site',
sprintf(
'wp.domReady( function() {
wp.editSite.initialize( "site-editor", %s );
} );',
wp_json_encode( $editor_settings )
)
);
block_editor_rest_api_preload( $preload_paths, $block_editor_context );

wp_add_inline_script(
'wp-edit-site',
sprintf(
'wp.domReady( function() {
wp.editSite.initializeList( "site-editor", "%s", %s );
} );',
$post_type->name,
wp_json_encode( $editor_settings )
)
);

} else {

$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
$active_theme = wp_get_theme()->get_stylesheet();
$preload_paths = array(
array( '/wp/v2/media', 'OPTIONS' ),
'/',
'/wp/v2/types?context=edit',
'/wp/v2/taxonomies?context=edit',
'/wp/v2/pages?context=edit',
'/wp/v2/categories?context=edit',
'/wp/v2/posts?context=edit',
'/wp/v2/tags?context=edit',
'/wp/v2/templates?context=edit',
'/wp/v2/template-parts?context=edit',
'/wp/v2/settings',
'/wp/v2/themes?context=edit&status=active',
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
'/wp/v2/global-styles/' . $active_global_styles_id,
'/wp/v2/themes/' . $active_theme . '/global-styles',
'/wp/v2/block-navigation-areas?context=edit',
);

$areas = get_option( 'wp_navigation_areas', array() );
$active_areas = array_intersect_key( $areas, get_navigation_areas() );
foreach ( $active_areas as $post_id ) {
if ( $post_id ) {
$preload_paths[] = add_query_arg( 'context', 'edit', rest_get_route_for_post( $post_id ) );
}
}

block_editor_rest_api_preload( $preload_paths, $block_editor_context );

wp_add_inline_script(
'wp-edit-site',
sprintf(
'wp.domReady( function() {
wp.editSite.initializeEditor( "site-editor", %s );
} );',
wp_json_encode( $editor_settings )
)
);

}

// Preload server-registered block schemas.
wp_add_inline_script(
Expand Down