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 #1883

Closed
wants to merge 4 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
1,779 changes: 884 additions & 895 deletions package-lock.json

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static function( $classes ) {
'/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 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/wp-includes/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static function () use ( $style ) {
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, '/' )
);

Expand Down
74 changes: 39 additions & 35 deletions src/wp-includes/blocks/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/**
* 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;
}

$post = get_post( $post_id );

block_core_calendar_update_has_published_posts();
if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
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;
}
block_core_calendar_update_has_published_posts();
}

if ( 'post' !== get_post_type( $post ) ) {
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 ( is_multisite() ) {
return;
}

if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
return;
}
if ( $new_status === $old_status ) {
return;
}

block_core_calendar_update_has_published_posts();
if ( 'post' !== get_post_type( $post ) ) {
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 );
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 );
16 changes: 14 additions & 2 deletions src/wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
}
Expand Down Expand Up @@ -179,12 +179,24 @@ function( $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 = '';
Expand Down
11 changes: 8 additions & 3 deletions src/wp-includes/navigation-areas.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ public function get_item( $request ) {
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 );
Expand All @@ -196,7 +196,7 @@ public function update_item( $request ) {
*/
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down