Make WordPress Core


Ignore:
Timestamp:
11/23/2021 05:38:45 AM (3 years ago)
Author:
noisysocks
Message:

Update @wordpress packages

Update packages to include these bug fixes from Gutenberg:

  • FSE: Add welcome guide
  • Update theme styles for the code block
  • Add feature flag to toggle the new site editor sidebar
  • Add templates list page for site editor
  • Cover Block: Fix default background dim
  • E2E: Add more Cover block tests
  • Cover Block: Fix regressions
  • Post Comments Form: ensure typography styles are applied to child elements
  • Navigation: Fix space-between
  • Fix background colours in nested submenus.
  • Fix duplicate custom classnames in navigation submenu block
  • Fix colour rendering in Navigation overlay
  • Fix: Add ability to opt out of Core color palette V2
  • Change @package to WordPress in block-library
  • Make the core color palette opt-in for themes with not theme.json
  • Remove textdomain from calendar block
  • Page List block: fix space before href attribute
  • Try: Let Featured Image block inherit dimensions, look like a placeholder
  • [Global Styles]: Add block icon next to blocks list
  • Page List: Use core entities instead of direct apiFetch
  • Site Editor: Stabilize export endpoint
  • Fix mobile horizontal scrollbar.
  • Multi-entity save: Only set site entity to pending if really saving
  • Add page list to navigation direct insert conditions
  • Implement "Add New" for templates list in Site Editor
  • Post Featured Image: Remove withNotices HOC
  • Fix page list missing button styles when set to open on click.
  • Make appender fixed position to avoid jumps in the UI
  • Color UI component: reorder palettes and update names (core by defaults, user by custom)
  • Remove the Styles link in Site Editor
  • GlobalStyles sidebar: do not show default palette if theme opts-out
  • Only render the site editor canvas when the global styles are ready.
  • Global Styles: rename core origin key to default for presets
  • Clarify i18n context for PostTemplateActions's "New" label
  • Revert erroneous native editor package version bumps
  • Try: Hide the columns inserter in pattern previews.
  • Fix site editor region navigation
  • Update navigation sidebar responsiveness
  • Add _wp_array_set and _wp_to_kebab_case to 5.8 compat
  • Make user able to change all color palette origins
  • Site Editor: Update hrefs to not specifically refer to themes.php?page=gutenberg-edit-site
  • Site Editor: Validate the postType query argument
  • Navigation: Scale submenu icon.
  • Move the theme editor under tools for FSE themes
  • Deprecate navigation areas

See #54487.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/site-editor.php

    r52161 r52232  
    4141
    4242$block_editor_context = new WP_Block_Editor_Context();
     43$custom_settings      = array(
     44    'siteUrl'                              => site_url(),
     45    'postsPerPage'                         => get_option( 'posts_per_page' ),
     46    'styles'                               => get_block_editor_theme_styles(),
     47    'defaultTemplateTypes'                 => get_default_block_template_types(),
     48    'defaultTemplatePartAreas'             => get_allowed_block_template_part_areas(),
     49    '__experimentalBlockPatterns'          => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
     50    '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
     51);
     52$editor_settings      = get_block_editor_settings( $custom_settings, $block_editor_context );
    4353
    44 $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
    45 $active_theme            = wp_get_theme()->get_stylesheet();
    46 $preload_paths           = array(
    47     array( '/wp/v2/media', 'OPTIONS' ),
    48     '/',
    49     '/wp/v2/types?context=edit',
    50     '/wp/v2/taxonomies?context=edit',
    51     '/wp/v2/pages?context=edit',
    52     '/wp/v2/categories?context=edit',
    53     '/wp/v2/posts?context=edit',
    54     '/wp/v2/tags?context=edit',
    55     '/wp/v2/templates?context=edit',
    56     '/wp/v2/template-parts?context=edit',
    57     '/wp/v2/settings',
    58     '/wp/v2/themes?context=edit&status=active',
    59     '/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
    60     '/wp/v2/global-styles/' . $active_global_styles_id,
    61     '/wp/v2/themes/' . $active_theme . '/global-styles',
    62     '/wp/v2/block-navigation-areas?context=edit',
    63 );
     54if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
    6455
    65 $areas        = get_option( 'wp_navigation_areas', array() );
    66 $active_areas = array_intersect_key( $areas, get_navigation_areas() );
    67 foreach ( $active_areas as $post_id ) {
    68     if ( $post_id ) {
    69         $preload_paths[] = add_query_arg( 'context', 'edit', rest_get_route_for_post( $post_id ) );
     56    $post_type = get_post_type_object( $_GET['postType'] );
     57
     58    if ( ! $post_type ) {
     59        wp_die( __( 'Invalid post type.' ) );
    7060    }
     61
     62    $preload_paths = array(
     63        '/',
     64        '/wp/v2/types/' . $post_type->name . '?context=edit',
     65        '/wp/v2/types?context=edit',
     66        '/wp/v2/' . $post_type->rest_base . '?context=edit',
     67    );
     68
     69    block_editor_rest_api_preload( $preload_paths, $block_editor_context );
     70
     71    wp_add_inline_script(
     72        'wp-edit-site',
     73        sprintf(
     74            'wp.domReady( function() {
     75                wp.editSite.initializeList( "site-editor", "%s", %s );
     76            } );',
     77            $post_type->name,
     78            wp_json_encode( $editor_settings )
     79        )
     80    );
     81
     82} else {
     83
     84    $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_custom_post_type_id();
     85    $active_theme            = wp_get_theme()->get_stylesheet();
     86    $preload_paths           = array(
     87        array( '/wp/v2/media', 'OPTIONS' ),
     88        '/',
     89        '/wp/v2/types?context=edit',
     90        '/wp/v2/taxonomies?context=edit',
     91        '/wp/v2/pages?context=edit',
     92        '/wp/v2/categories?context=edit',
     93        '/wp/v2/posts?context=edit',
     94        '/wp/v2/tags?context=edit',
     95        '/wp/v2/templates?context=edit',
     96        '/wp/v2/template-parts?context=edit',
     97        '/wp/v2/settings',
     98        '/wp/v2/themes?context=edit&status=active',
     99        '/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
     100        '/wp/v2/global-styles/' . $active_global_styles_id,
     101        '/wp/v2/themes/' . $active_theme . '/global-styles',
     102        '/wp/v2/block-navigation-areas?context=edit',
     103    );
     104
     105    $areas        = get_option( 'wp_navigation_areas', array() );
     106    $active_areas = array_intersect_key( $areas, get_navigation_areas() );
     107    foreach ( $active_areas as $post_id ) {
     108        if ( $post_id ) {
     109            $preload_paths[] = add_query_arg( 'context', 'edit', rest_get_route_for_post( $post_id ) );
     110        }
     111    }
     112
     113    block_editor_rest_api_preload( $preload_paths, $block_editor_context );
     114
     115    wp_add_inline_script(
     116        'wp-edit-site',
     117        sprintf(
     118            'wp.domReady( function() {
     119                wp.editSite.initializeEditor( "site-editor", %s );
     120            } );',
     121            wp_json_encode( $editor_settings )
     122        )
     123    );
     124
    71125}
    72 
    73 block_editor_rest_api_preload( $preload_paths, $block_editor_context );
    74 
    75 $editor_settings = get_block_editor_settings(
    76     array(
    77         'siteUrl'                              => site_url(),
    78         'postsPerPage'                         => get_option( 'posts_per_page' ),
    79         'styles'                               => get_block_editor_theme_styles(),
    80         'defaultTemplateTypes'                 => get_default_block_template_types(),
    81         'defaultTemplatePartAreas'             => get_allowed_block_template_part_areas(),
    82         '__experimentalBlockPatterns'          => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
    83         '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
    84     ),
    85     $block_editor_context
    86 );
    87 
    88 wp_add_inline_script(
    89     'wp-edit-site',
    90     sprintf(
    91         'wp.domReady( function() {
    92             wp.editSite.initialize( "site-editor", %s );
    93         } );',
    94         wp_json_encode( $editor_settings )
    95     )
    96 );
    97126
    98127// Preload server-registered block schemas.
Note: See TracChangeset for help on using the changeset viewer.