Skip to content

Commit

Permalink
Block Editor: Updated the WordPress packages to include Gutenberg 15.…
Browse files Browse the repository at this point in the history
…1.0 changes.

In addition to all the packages being updated to the latest versions, 
this commit also includes some mandatory changes to avoid editor breakage:

 - Update React to to 18.2.0.
 - Add the right stylesheets to support iframed block editors.

Props ntsekouras, mamaduka, flixos90, desrosj, peterwilsoncc.
See #57471.


git-svn-id: https://develop.svn.wordpress.org/trunk@55246 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
youknowriad committed Feb 7, 2023
1 parent d46dc08 commit 07fc9b2
Show file tree
Hide file tree
Showing 122 changed files with 3,766 additions and 3,701 deletions.
6,050 changes: 2,618 additions & 3,432 deletions package-lock.json

Large diffs are not rendered by default.

125 changes: 63 additions & 62 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"devDependencies": {
"@lodder/grunt-postcss": "^3.1.1",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
"@wordpress/babel-preset-default": "7.1.1",
"@wordpress/dependency-extraction-webpack-plugin": "4.0.2",
"@wordpress/e2e-test-utils": "8.1.1",
"@wordpress/scripts": "24.1.2",
"@wordpress/babel-preset-default": "7.10.1",
"@wordpress/dependency-extraction-webpack-plugin": "4.9.1",
"@wordpress/e2e-test-utils": "9.3.1",
"@wordpress/scripts": "25.3.1",
"autoprefixer": "^10.4.13",
"chalk": "5.2.0",
"check-node-version": "4.2.1",
Expand Down Expand Up @@ -77,62 +77,63 @@
"webpack-livereload-plugin": "3.0.2"
},
"dependencies": {
"@wordpress/a11y": "3.17.1",
"@wordpress/annotations": "2.17.3",
"@wordpress/api-fetch": "6.14.1",
"@wordpress/autop": "3.17.1",
"@wordpress/blob": "3.17.1",
"@wordpress/block-directory": "3.15.12",
"@wordpress/block-editor": "10.0.10",
"@wordpress/block-library": "7.14.12",
"@wordpress/block-serialization-default-parser": "4.17.1",
"@wordpress/blocks": "11.16.4",
"@wordpress/components": "21.0.7",
"@wordpress/compose": "5.15.2",
"@wordpress/core-data": "5.0.4",
"@wordpress/customize-widgets": "3.14.12",
"@wordpress/data": "7.1.3",
"@wordpress/data-controls": "2.17.3",
"@wordpress/date": "4.17.1",
"@wordpress/deprecated": "3.17.1",
"@wordpress/dom": "3.17.2",
"@wordpress/dom-ready": "3.17.1",
"@wordpress/edit-post": "6.14.12",
"@wordpress/edit-site": "4.14.14",
"@wordpress/edit-widgets": "4.14.12",
"@wordpress/editor": "12.16.10",
"@wordpress/element": "4.15.1",
"@wordpress/escape-html": "2.17.1",
"@wordpress/format-library": "3.15.10",
"@wordpress/hooks": "3.17.1",
"@wordpress/html-entities": "3.17.1",
"@wordpress/i18n": "4.17.1",
"@wordpress/icons": "9.8.1",
"@wordpress/interface": "4.16.7",
"@wordpress/is-shallow-equal": "4.17.1",
"@wordpress/keyboard-shortcuts": "3.15.3",
"@wordpress/keycodes": "3.17.1",
"@wordpress/list-reusable-blocks": "3.15.7",
"@wordpress/media-utils": "4.8.1",
"@wordpress/notices": "3.17.3",
"@wordpress/nux": "5.15.7",
"@wordpress/plugins": "4.15.2",
"@wordpress/preferences": "2.9.7",
"@wordpress/preferences-persistence": "1.9.1",
"@wordpress/primitives": "3.15.1",
"@wordpress/priority-queue": "2.17.2",
"@wordpress/redux-routine": "4.17.1",
"@wordpress/reusable-blocks": "3.15.10",
"@wordpress/rich-text": "5.15.3",
"@wordpress/server-side-render": "3.15.7",
"@wordpress/shortcode": "3.17.1",
"@wordpress/style-engine": "1.0.3",
"@wordpress/token-list": "2.17.1",
"@wordpress/url": "3.18.1",
"@wordpress/viewport": "4.15.3",
"@wordpress/warning": "2.17.1",
"@wordpress/widgets": "2.15.10",
"@wordpress/wordcount": "3.17.1",
"@wordpress/a11y": "3.26.1",
"@wordpress/annotations": "2.26.1",
"@wordpress/api-fetch": "6.23.1",
"@wordpress/autop": "3.26.1",
"@wordpress/blob": "3.26.1",
"@wordpress/block-directory": "4.3.1",
"@wordpress/block-editor": "11.3.1",
"@wordpress/block-library": "8.3.1",
"@wordpress/block-serialization-default-parser": "4.26.1",
"@wordpress/blocks": "12.3.1",
"@wordpress/components": "23.3.1",
"@wordpress/compose": "6.3.1",
"@wordpress/core-data": "6.3.1",
"@wordpress/customize-widgets": "4.3.1",
"@wordpress/data": "8.3.1",
"@wordpress/data-controls": "2.26.1",
"@wordpress/date": "4.26.1",
"@wordpress/deprecated": "3.26.1",
"@wordpress/dom": "3.26.1",
"@wordpress/dom-ready": "3.26.1",
"@wordpress/edit-post": "7.3.1",
"@wordpress/edit-site": "5.3.1",
"@wordpress/edit-widgets": "5.3.1",
"@wordpress/editor": "13.3.1",
"@wordpress/element": "5.3.1",
"@wordpress/escape-html": "2.26.1",
"@wordpress/experiments": "0.8.1",
"@wordpress/format-library": "4.3.1",
"@wordpress/hooks": "3.26.1",
"@wordpress/html-entities": "3.26.1",
"@wordpress/i18n": "4.26.1",
"@wordpress/icons": "9.17.1",
"@wordpress/interface": "5.3.1",
"@wordpress/is-shallow-equal": "4.26.1",
"@wordpress/keyboard-shortcuts": "4.3.1",
"@wordpress/keycodes": "3.26.1",
"@wordpress/list-reusable-blocks": "4.3.1",
"@wordpress/media-utils": "4.17.1",
"@wordpress/notices": "3.26.1",
"@wordpress/nux": "6.0.0",
"@wordpress/plugins": "5.3.1",
"@wordpress/preferences": "3.3.1",
"@wordpress/preferences-persistence": "1.18.1",
"@wordpress/primitives": "3.24.1",
"@wordpress/priority-queue": "2.26.1",
"@wordpress/redux-routine": "4.26.1",
"@wordpress/reusable-blocks": "4.3.1",
"@wordpress/rich-text": "6.3.1",
"@wordpress/server-side-render": "4.3.1",
"@wordpress/shortcode": "3.26.1",
"@wordpress/style-engine": "1.9.1",
"@wordpress/token-list": "2.26.1",
"@wordpress/url": "3.27.1",
"@wordpress/viewport": "5.3.1",
"@wordpress/warning": "2.26.1",
"@wordpress/widgets": "3.3.1",
"@wordpress/wordcount": "3.26.1",
"backbone": "1.4.1",
"clipboard": "2.0.11",
"core-js-url-browser": "3.6.4",
Expand All @@ -150,8 +151,8 @@
"moment": "2.29.4",
"objectFitPolyfill": "2.3.5",
"polyfill-library": "4.4.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"regenerator-runtime": "0.13.9",
"underscore": "1.13.6",
"whatwg-fetch": "3.6.2",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions src/wp-includes/blocks/archives.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
function render_block_core_archives( $attributes ) {
$show_post_count = ! empty( $attributes['showPostCounts'] );
$type = isset( $attributes['type'] ) ? $attributes['type'] : 'monthly';
$class = '';

$class = 'wp-block-archives-list';

if ( ! empty( $attributes['displayAsDropdown'] ) ) {

$class .= ' wp-block-archives-dropdown';
$class = 'wp-block-archives-dropdown';

$dropdown_id = wp_unique_id( 'wp-block-archives-' );
$title = __( 'Archives' );
Expand All @@ -40,9 +41,7 @@ function render_block_core_archives( $attributes ) {

$archives = wp_get_archives( $dropdown_args );

$classnames = esc_attr( $class );

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $class ) );

switch ( $dropdown_args['type'] ) {
case 'yearly':
Expand Down Expand Up @@ -75,8 +74,6 @@ function render_block_core_archives( $attributes ) {
);
}

$class .= ' wp-block-archives-list';

/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
$archives_args = apply_filters(
'widget_archives_args',
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/blocks/archives/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function render_block_core_avatar( $attributes, $content, $block ) {
$label = 'aria-label="' . sprintf( esc_attr__( '(%s author archive, opens in a new tab)' ), $author_name ) . '"';
}
// translators: %1$s: Author archive link. %2$s: Link target. %3$s Aria label. %4$s Avatar image.
$avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', get_author_posts_url( $author_id ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block );
$avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( get_author_posts_url( $author_id ) ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block );
}
return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block );
}
Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/blocks/avatar/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "core/avatar",
"title": "Avatar",
"category": "theme",
"description": "Add a user's avatar.",
"description": "Add a users avatar.",
"textdomain": "default",
"attributes": {
"userId": {
Expand All @@ -25,6 +25,7 @@
},
"usesContext": [ "postType", "postId", "commentId" ],
"supports": {
"anchor": true,
"html": false,
"align": true,
"alignWide": false,
Expand Down
3 changes: 1 addition & 2 deletions src/wp-includes/blocks/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ function render_block_core_block( $attributes ) {
if ( isset( $seen_refs[ $attributes['ref'] ] ) ) {
// WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
// is set in `wp_debug_mode()`.
$is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG &&
defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY;
$is_debug = WP_DEBUG && WP_DEBUG_DISPLAY;

return $is_debug ?
// translators: Visible only in the front end, this warning takes the place of a faulty block.
Expand Down
3 changes: 1 addition & 2 deletions src/wp-includes/blocks/block/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
"customClassName": false,
"html": false,
"inserter": false
},
"editorStyle": "wp-block-editor"
}
}
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/blocks-json.php

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/wp-includes/blocks/button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"keywords": [ "link" ],
"textdomain": "default",
"attributes": {
"textAlign": {
"type": "string"
},
"url": {
"type": "string",
"source": "attribute",
Expand Down Expand Up @@ -56,7 +59,7 @@
},
"supports": {
"anchor": true,
"align": true,
"align": false,
"alignWide": false,
"color": {
"__experimentalSkipSerialization": true,
Expand All @@ -80,6 +83,7 @@
}
},
"reusable": false,
"shadow": true,
"spacing": {
"__experimentalSkipSerialization": true,
"padding": [ "horizontal", "vertical" ],
Expand Down
25 changes: 24 additions & 1 deletion src/wp-includes/blocks/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,34 @@ function render_block_core_calendar( $attributes ) {
}
}

$color_block_styles = array();

// Text color.
$preset_text_color = array_key_exists( 'textColor', $attributes ) ? "var:preset|color|{$attributes['textColor']}" : null;
$custom_text_color = _wp_array_get( $attributes, array( 'style', 'color', 'text' ), null );
$color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color;

// Background Color.
$preset_background_color = array_key_exists( 'backgroundColor', $attributes ) ? "var:preset|color|{$attributes['backgroundColor']}" : null;
$custom_background_color = _wp_array_get( $attributes, array( 'style', 'color', 'background' ), null );
$color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;

// Generate color styles and classes.
$styles = wp_style_engine_get_styles( array( 'color' => $color_block_styles ), array( 'convert_vars_to_classnames' => true ) );
$inline_styles = empty( $styles['css'] ) ? '' : sprintf( ' style="%s"', esc_attr( $styles['css'] ) );
$classnames = empty( $styles['classnames'] ) ? '' : ' ' . esc_attr( $styles['classnames'] );
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
$classnames .= ' has-link-color';
}
// Apply color classes and styles to the calendar.
$calendar = str_replace( '<table', '<table' . $inline_styles, get_calendar( true, false ) );
$calendar = str_replace( 'class="wp-calendar-table', 'class="wp-calendar-table' . $classnames, $calendar );

$wrapper_attributes = get_block_wrapper_attributes();
$output = sprintf(
'<div %1$s>%2$s</div>',
$wrapper_attributes,
get_calendar( true, false )
$calendar
);

// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
Expand Down
10 changes: 10 additions & 0 deletions src/wp-includes/blocks/calendar/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
},
"supports": {
"align": true,
"anchor": true,
"color": {
"link": true,
"__experimentalSkipSerialization": [ "text", "background" ],
"__experimentalDefaultControls": {
"background": true,
"text": true
},
"__experimentalSelector": "table, th"
},
"typography": {
"fontSize": true,
"lineHeight": true,
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
function render_block_core_categories( $attributes ) {
static $block_id = 0;
$block_id++;
++$block_id;

$args = array(
'echo' => false,
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/blocks/categories/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"supports": {
"align": true,
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
9 changes: 6 additions & 3 deletions src/wp-includes/blocks/comment-author-name.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
return '';
}

$classes = '';
$classes = array();
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . $attributes['textAlign'];
$classes[] = 'has-text-align-' . $attributes['textAlign'];
}
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
$classes[] = 'has-link-color';
}

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
$comment_author = get_comment_author( $comment );
$link = get_comment_author_url( $comment );

Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/blocks/comment-author-name/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"usesContext": [ "commentId" ],
"supports": {
"anchor": true,
"html": false,
"spacing": {
"margin": true,
Expand Down
9 changes: 6 additions & 3 deletions src/wp-includes/blocks/comment-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
}
}

$classes = '';
$classes = array();
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . $attributes['textAlign'];
$classes[] = 'has-text-align-' . $attributes['textAlign'];
}
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
$classes[] = 'has-link-color';
}

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );

return sprintf(
'<div %1$s>%2$s%3$s</div>',
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/blocks/comment-content/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}
},
"supports": {
"anchor": true,
"color": {
"gradients": true,
"link": true,
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/comment-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
return '';
}

$classes = '';
$classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
$formatted_date = get_comment_date(
Expand Down
Loading

0 comments on commit 07fc9b2

Please sign in to comment.