Update @wordpress packages

Update packages to include these bug fixes from Gutenberg:

- Navigation: Fix click-button size, submenu directions, scrollbars.
- Group - Fix overzealous regex when restoring inner containers
- Babel Preset: Update Babel packages to 7.16 version
- theme.json: adds a setting property that enables some other ones
- Polish metabox container.
- Fix submenu justification and spacer orientation.
- Fix Gutenberg 11.8.2 in WordPress trunk
- Strip meta tags from pasted links in Chromium
- Hide visilibility and status for navigation posts
- Navigation: Refactor and simplify setup state.
- Nav block menu switcher - decode HTML entities and utilise accessible markup pattern
- Rename fse_navigation_area to wp_navigation_area
- theme.json: adds a setting property that enables some other ones
- Revert "theme.json: adds a setting property that enables some other ones"
- Skip flaky image block test
- WordPress/gutenberg@3c935c4
- React to any errors coming up in gutenberg_migrate_menu_to_navigation_post
- Return wp error from wp_insert_post
- Fix not transforming logical assignments for packages

See #54337.


git-svn-id: https://develop.svn.wordpress.org/trunk@52161 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Robert Anderson
2021-11-15 12:47:22 +00:00
parent 47b5b384e5
commit 9b142dd264
10 changed files with 988 additions and 978 deletions

1735
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,12 +24,12 @@
"last 2 Opera versions"
],
"devDependencies": {
"@wordpress/babel-preset-default": "6.3.4",
"@wordpress/babel-preset-default": "6.4.1",
"@wordpress/custom-templated-path-webpack-plugin": "2.1.0",
"@wordpress/dependency-extraction-webpack-plugin": "3.2.1",
"@wordpress/e2e-test-utils": "5.4.7",
"@wordpress/e2e-test-utils": "5.4.8",
"@wordpress/library-export-default-webpack-plugin": "2.2.0",
"@wordpress/scripts": "19.1.0",
"@wordpress/scripts": "19.2.1",
"autoprefixer": "^9.8.8",
"chalk": "4.1.2",
"check-node-version": "4.1.0",
@@ -77,59 +77,59 @@
"webpack-livereload-plugin": "2.3.0"
},
"dependencies": {
"@wordpress/a11y": "3.2.3",
"@wordpress/annotations": "2.2.6",
"@wordpress/api-fetch": "5.2.5",
"@wordpress/autop": "3.2.2",
"@wordpress/blob": "3.2.1",
"@wordpress/block-directory": "3.0.7",
"@wordpress/block-editor": "8.0.1",
"@wordpress/block-library": "6.0.5",
"@wordpress/block-serialization-default-parser": "4.2.2",
"@wordpress/blocks": "11.1.3",
"@wordpress/components": "19.0.1",
"@wordpress/compose": "5.0.5",
"@wordpress/core-data": "4.0.6",
"@wordpress/customize-widgets": "2.0.7",
"@wordpress/data": "6.1.3",
"@wordpress/data-controls": "2.2.6",
"@wordpress/date": "4.2.2",
"@wordpress/deprecated": "3.2.2",
"@wordpress/dom": "3.2.6",
"@wordpress/dom-ready": "3.2.2",
"@wordpress/edit-post": "5.0.7",
"@wordpress/edit-site": "3.0.7",
"@wordpress/edit-widgets": "3.1.2",
"@wordpress/editor": "12.0.4",
"@wordpress/element": "4.0.3",
"@wordpress/escape-html": "2.2.2",
"@wordpress/format-library": "3.0.7",
"@wordpress/hooks": "3.2.1",
"@wordpress/html-entities": "3.2.2",
"@wordpress/i18n": "4.2.3",
"@wordpress/icons": "6.1.0",
"@wordpress/interface": "4.1.3",
"@wordpress/is-shallow-equal": "4.2.0",
"@wordpress/keyboard-shortcuts": "3.0.5",
"@wordpress/keycodes": "3.2.3",
"@wordpress/list-reusable-blocks": "3.0.5",
"@wordpress/media-utils": "3.0.4",
"@wordpress/notices": "3.2.6",
"@wordpress/nux": "5.0.5",
"@wordpress/plugins": "4.0.5",
"@wordpress/primitives": "3.0.3",
"@wordpress/priority-queue": "2.2.2",
"@wordpress/redux-routine": "4.2.1",
"@wordpress/reusable-blocks": "3.0.7",
"@wordpress/rich-text": "5.0.5",
"@wordpress/server-side-render": "3.0.5",
"@wordpress/shortcode": "3.2.2",
"@wordpress/token-list": "2.2.1",
"@wordpress/url": "3.3.0",
"@wordpress/viewport": "4.0.5",
"@wordpress/a11y": "3.2.4",
"@wordpress/annotations": "2.2.7",
"@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-serialization-default-parser": "4.2.3",
"@wordpress/blocks": "11.1.4",
"@wordpress/components": "19.0.3",
"@wordpress/compose": "5.0.6",
"@wordpress/core-data": "4.0.7",
"@wordpress/customize-widgets": "2.0.9",
"@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/element": "4.0.4",
"@wordpress/escape-html": "2.2.3",
"@wordpress/format-library": "3.0.9",
"@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/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/media-utils": "3.0.5",
"@wordpress/notices": "3.2.7",
"@wordpress/nux": "5.0.7",
"@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/rich-text": "5.0.6",
"@wordpress/server-side-render": "3.0.7",
"@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.7",
"@wordpress/wordcount": "3.2.2",
"@wordpress/widgets": "2.0.9",
"@wordpress/wordcount": "3.2.3",
"backbone": "1.4.0",
"clipboard": "2.0.8",
"core-js-url-browser": "3.6.4",

View File

@@ -62,7 +62,7 @@ $preload_paths = array(
'/wp/v2/block-navigation-areas?context=edit',
);
$areas = get_option( 'fse_navigation_areas', array() );
$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 ) {

File diff suppressed because one or more lines are too long

View File

@@ -222,7 +222,7 @@ add_filter( 'render_block', 'wp_render_layout_support_flag', 10, 2 );
function wp_restore_group_inner_container( $block_content, $block ) {
$tag_name = isset( $block['attrs']['tagName'] ) ? $block['attrs']['tagName'] : 'div';
$group_with_inner_container_regex = sprintf(
'/(^\s*<%1$s\b[^>]*wp-block-group(\s|")[^>]*>)(\s*<div\b[^>]*wp-block-group__inner-container(\s|")[^>]*>)((.|\S|\s)*)/',
'/(^\s*<%1$s\b[^>]*wp-block-group(\s|")[^>]*>)(\s*<div\b[^>]*wp-block-group__inner-container(\s|")[^>]*>)((.|\S|\s)*)/U',
preg_quote( $tag_name, '/' )
);

View File

@@ -107,47 +107,51 @@ function block_core_calendar_update_has_published_posts() {
return $has_published_posts;
}
// We only want to register these functions and actions when
// we are on single sites. On multi sites we use `post_count` option.
if ( ! is_multisite() ) {
/**
* Handler for updating the has published posts flag when a post is deleted.
*
* @param int $post_id Deleted post ID.
*/
function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
$post = get_post( $post_id );
if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
return;
}
block_core_calendar_update_has_published_posts();
/**
* Handler for updating the has published posts flag when a post is deleted.
*
* @param int $post_id Deleted post ID.
*/
function block_core_calendar_update_has_published_post_on_delete( $post_id ) {
if ( is_multisite() ) {
return;
}
/**
* Handler for updating the has published posts flag when a post status changes.
*
* @param string $new_status The status the post is changing to.
* @param string $old_status The status the post is changing from.
* @param WP_Post $post Post object.
*/
function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {
if ( $new_status === $old_status ) {
return;
}
$post = get_post( $post_id );
if ( 'post' !== get_post_type( $post ) ) {
return;
}
if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
return;
}
block_core_calendar_update_has_published_posts();
if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
return;
}
add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 );
block_core_calendar_update_has_published_posts();
}
/**
* Handler for updating the has published posts flag when a post status changes.
*
* @param string $new_status The status the post is changing to.
* @param string $old_status The status the post is changing from.
* @param WP_Post $post Post object.
*/
function block_core_calendar_update_has_published_post_on_transition_post_status( $new_status, $old_status, $post ) {
if ( is_multisite() ) {
return;
}
if ( $new_status === $old_status ) {
return;
}
if ( 'post' !== get_post_type( $post ) ) {
return;
}
if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
return;
}
block_core_calendar_update_has_published_posts();
}
add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
add_action( 'transition_post_status', 'block_core_calendar_update_has_published_post_on_transition_post_status', 10, 3 );

View File

@@ -147,7 +147,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
if ( ! empty( $block->context['navigationArea'] ) ) {
$area = $block->context['navigationArea'];
$mapping = get_option( 'fse_navigation_areas', array() );
$mapping = get_option( 'wp_navigation_areas', array() );
if ( ! empty( $mapping[ $area ] ) ) {
$attributes['navigationMenuId'] = $mapping[ $area ];
}
@@ -179,12 +179,24 @@ function render_block_core_navigation( $attributes, $content, $block ) {
if ( empty( $inner_blocks ) ) {
return '';
}
// Restore legacy classnames for submenu positioning.
$layout_class = '';
if ( isset( $attributes['layout']['justifyContent'] ) ) {
if ( 'right' === $attributes['layout']['justifyContent'] ) {
$layout_class .= 'items-justified-right';
} elseif ( 'space-between' === $attributes['layout']['justifyContent'] ) {
$layout_class .= 'items-justified-space-between';
}
}
$colors = block_core_navigation_build_css_colors( $attributes );
$font_sizes = block_core_navigation_build_css_font_sizes( $attributes );
$classes = array_merge(
$colors['css_classes'],
$font_sizes['css_classes'],
$is_responsive_menu ? array( 'is-responsive' ) : array()
$is_responsive_menu ? array( 'is-responsive' ) : array(),
$layout_class ? array( $layout_class ) : array()
);
$inner_blocks_html = '';

View File

@@ -78,7 +78,7 @@ function _wp_migrate_menu_to_navigation_post( $new_name, WP_Theme $new_theme, WP
add_filter( 'option_stylesheet', $get_old_theme_stylesheet );
$locations = get_nav_menu_locations();
$area_mapping = get_option( 'fse_navigation_areas', array() );
$area_mapping = get_option( 'wp_navigation_areas', array() );
foreach ( $locations as $location_name => $menu_id ) {
// Get the menu from the location, skipping if there is no
@@ -123,14 +123,19 @@ function _wp_migrate_menu_to_navigation_post( $new_name, WP_Theme $new_theme, WP
'post_content' => serialize_blocks( $parsed_blocks ),
'post_status' => 'publish',
);
$navigation_post_id = wp_insert_post( $post_data );
$navigation_post_id = wp_insert_post( $post_data, true );
// If wp_insert_post fails *at any time*, then bail out of the
// entire migration attempt returning the WP_Error object.
if ( is_wp_error( $navigation_post_id ) ) {
return $navigation_post_id;
}
}
$area_mapping[ $location_name ] = $navigation_post_id;
}
remove_filter( 'option_stylesheet', $get_old_theme_stylesheet );
update_option( 'fse_navigation_areas', $area_mapping );
update_option( 'wp_navigation_areas', $area_mapping );
}
/**

View File

@@ -177,9 +177,9 @@ class WP_REST_Block_Navigation_Areas_Controller extends WP_REST_Controller {
public function update_item( $request ) {
$name = $request['area'];
$mapping = get_option( 'fse_navigation_areas', array() );
$mapping = get_option( 'wp_navigation_areas', array() );
$mapping[ $name ] = $request['navigation'];
update_option( 'fse_navigation_areas', $mapping );
update_option( 'wp_navigation_areas', $mapping );
$area = $this->get_navigation_area_object( $name );
$data = $this->prepare_item_for_response( $area, $request );
@@ -196,7 +196,7 @@ class WP_REST_Block_Navigation_Areas_Controller extends WP_REST_Controller {
*/
protected function get_navigation_area_object( $name ) {
$available_areas = get_navigation_areas();
$mapping = get_option( 'fse_navigation_areas', array() );
$mapping = get_option( 'wp_navigation_areas', array() );
$area = new stdClass();
$area->name = $name;
$area->navigation = ! empty( $mapping[ $name ] ) ? $mapping[ $name ] : null;

View File

@@ -9,7 +9,7 @@
*/
class Tests_REST_WpRestBlockNavigationAreasController extends WP_Test_REST_Controller_Testcase {
const OPTION = 'fse_navigation_areas';
const OPTION = 'wp_navigation_areas';
/**
* @var int Administrator user ID