Editor: Update WordPress packages for 6.0 Beta 4

Included cherry-picked commits from the Gutenberg plugin that fix bugs discovere after WordPress 6.0 Beta 3.

Props zieladam, ndiego, darerodz.
See #55567.




git-svn-id: https://develop.svn.wordpress.org/trunk@53329 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Greg Ziółkowski 2022-05-02 10:36:45 +00:00
parent 1b9551de27
commit e0837a8b18
11 changed files with 625 additions and 540 deletions

View File

@ -1675,7 +1675,7 @@ module.exports = function(grunt) {
grunt.registerTask( 'wp-packages:update', 'Update WordPress packages', function() {
const distTag = grunt.option('dist-tag') || 'latest';
grunt.log.writeln( `Updating WordPress packages (--dist-tag=${distTag})` );
spawn( 'npx', [ 'wp-scripts', 'packages-update', '--', `--dist-tag=${distTag}` ], {
spawn( 'npx', [ 'wp-scripts', 'packages-update', `--dist-tag=${distTag}` ], {
cwd: __dirname,
stdio: 'inherit',
} );

970
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
"@wordpress/babel-preset-default": "6.8.1",
"@wordpress/dependency-extraction-webpack-plugin": "3.4.2",
"@wordpress/e2e-test-utils": "7.2.1",
"@wordpress/scripts": "22.5.0",
"@wordpress/scripts": "22.4.2",
"autoprefixer": "^9.8.8",
"chalk": "5.0.1",
"check-node-version": "4.2.1",
@ -77,58 +77,59 @@
},
"dependencies": {
"@wordpress/a11y": "3.6.1",
"@wordpress/annotations": "2.6.1",
"@wordpress/annotations": "2.6.2",
"@wordpress/api-fetch": "6.3.1",
"@wordpress/autop": "3.6.1",
"@wordpress/blob": "3.6.1",
"@wordpress/block-directory": "3.4.3",
"@wordpress/block-editor": "8.5.3",
"@wordpress/block-library": "7.3.3",
"@wordpress/block-directory": "3.4.5",
"@wordpress/block-editor": "8.5.4",
"@wordpress/block-library": "7.3.5",
"@wordpress/block-serialization-default-parser": "4.6.1",
"@wordpress/blocks": "11.5.3",
"@wordpress/components": "19.8.2",
"@wordpress/components": "19.8.3",
"@wordpress/compose": "5.4.1",
"@wordpress/core-data": "4.4.3",
"@wordpress/customize-widgets": "3.3.3",
"@wordpress/core-data": "4.4.4",
"@wordpress/customize-widgets": "3.3.5",
"@wordpress/data": "6.6.1",
"@wordpress/data-controls": "2.6.1",
"@wordpress/date": "4.6.1",
"@wordpress/deprecated": "3.6.1",
"@wordpress/dom": "3.6.1",
"@wordpress/dom-ready": "3.6.1",
"@wordpress/edit-post": "6.3.3",
"@wordpress/edit-site": "4.3.3",
"@wordpress/edit-widgets": "4.3.3",
"@wordpress/editor": "12.5.3",
"@wordpress/edit-post": "6.3.5",
"@wordpress/edit-site": "4.3.5",
"@wordpress/edit-widgets": "4.3.5",
"@wordpress/editor": "12.5.4",
"@wordpress/element": "4.4.1",
"@wordpress/escape-html": "2.6.1",
"@wordpress/format-library": "3.4.3",
"@wordpress/format-library": "3.4.4",
"@wordpress/hooks": "3.6.1",
"@wordpress/html-entities": "3.6.1",
"@wordpress/i18n": "4.6.1",
"@wordpress/icons": "8.2.2",
"@wordpress/interface": "4.5.2",
"@wordpress/interface": "4.5.3",
"@wordpress/is-shallow-equal": "4.6.1",
"@wordpress/keyboard-shortcuts": "3.4.1",
"@wordpress/keycodes": "3.6.1",
"@wordpress/list-reusable-blocks": "3.4.2",
"@wordpress/list-reusable-blocks": "3.4.3",
"@wordpress/media-utils": "3.4.1",
"@wordpress/notices": "3.6.1",
"@wordpress/nux": "5.4.2",
"@wordpress/nux": "5.4.3",
"@wordpress/plugins": "4.4.2",
"@wordpress/preferences": "1.2.2",
"@wordpress/preferences": "1.2.3",
"@wordpress/primitives": "3.4.1",
"@wordpress/priority-queue": "2.6.1",
"@wordpress/redux-routine": "4.6.1",
"@wordpress/reusable-blocks": "3.4.3",
"@wordpress/rich-text": "5.4.1",
"@wordpress/server-side-render": "3.4.3",
"@wordpress/reusable-blocks": "3.4.4",
"@wordpress/rich-text": "5.4.2",
"@wordpress/server-side-render": "3.4.4",
"@wordpress/shortcode": "3.6.1",
"@wordpress/style-engine": "0.5.1",
"@wordpress/token-list": "2.6.1",
"@wordpress/url": "3.7.1",
"@wordpress/viewport": "4.4.1",
"@wordpress/warning": "2.6.1",
"@wordpress/widgets": "2.4.3",
"@wordpress/widgets": "2.4.4",
"@wordpress/wordcount": "3.6.1",
"backbone": "1.4.1",
"clipboard": "2.0.10",

File diff suppressed because one or more lines are too long

View File

@ -18,17 +18,16 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
return '';
}
$comment = get_comment( $block->context['commentId'] );
$comment = get_comment( $block->context['commentId'] );
$commenter = wp_get_current_commenter();
$show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
if ( empty( $comment ) ) {
return '';
}
$classes = '';
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . esc_attr( $attributes['textAlign'] );
}
if ( isset( $attributes['fontSize'] ) ) {
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
$classes .= 'has-text-align-' . $attributes['textAlign'];
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
@ -38,6 +37,9 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
if ( ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
$comment_author = sprintf( '<a rel="external nofollow ugc" href="%1s" target="%2s" >%3s</a>', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $comment_author );
}
if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
$comment_author = wp_kses( $comment_author, array() );
}
return sprintf(
'<div %1$s>%2$s</div>',

View File

@ -18,16 +18,37 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
return '';
}
$comment = get_comment( $block->context['commentId'] );
$comment = get_comment( $block->context['commentId'] );
$commenter = wp_get_current_commenter();
$show_pending_links = isset( $commenter['comment_author'] ) && $commenter['comment_author'];
if ( empty( $comment ) ) {
return '';
}
$comment_text = get_comment_text( $comment );
$args = array();
$comment_text = get_comment_text( $comment, $args );
if ( ! $comment_text ) {
return '';
}
/** This filter is documented in wp-includes/comment-template.php */
$comment_text = apply_filters( 'comment_text', $comment_text, $comment, $args );
$moderation_note = '';
if ( '0' === $comment->comment_approved ) {
$commenter = wp_get_current_commenter();
if ( $commenter['comment_author_email'] ) {
$moderation_note = __( 'Your comment is awaiting moderation.' );
} else {
$moderation_note = __( 'Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.' );
}
$moderation_note = '<p><em class="comment-awaiting-moderation">' . $moderation_note . '</em></p>';
if ( ! $show_pending_links ) {
$comment_text = wp_kses( $comment_text, array() );
}
}
$classes = '';
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . $attributes['textAlign'];
@ -36,8 +57,9 @@ function render_block_core_comment_content( $attributes, $content, $block ) {
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
return sprintf(
'<div %1$s>%2$s</div>',
'<div %1$s>%2$s%3$s</div>',
$wrapper_attributes,
$moderation_note,
$comment_text
);
}

View File

@ -29,11 +29,18 @@ function render_block_core_comments_title( $attributes ) {
return;
}
$single_default_comment_label = $show_post_title ? __( 'One response to' ) : __( 'One response' );
$single_comment_label = ! empty( $attributes['singleCommentLabel'] ) ? $attributes['singleCommentLabel'] : $single_default_comment_label;
$single_default_comment_label = $show_post_title ? __( 'Response to' ) : __( 'Response' );
if ( $show_comments_count ) {
$single_default_comment_label = $show_post_title ? __( 'One response to' ) : __( 'One response' );
}
$single_comment_label = ! empty( $attributes['singleCommentLabel'] ) ? $attributes['singleCommentLabel'] : $single_default_comment_label;
$multiple_default_comment_label = $show_post_title ? __( 'Responses to' ) : __( 'Responses' );
$multiple_comment_label = ! empty( $attributes['multipleCommentsLabel'] ) ? $attributes['multipleCommentsLabel'] : $multiple_default_comment_label;
if ( $show_comments_count ) {
$multiple_default_comment_label = $show_post_title ? __( 'responses to' ) : __( 'responses' );
}
$multiple_comment_label = ! empty( $attributes['multipleCommentsLabel'] ) ? $attributes['multipleCommentsLabel'] : $multiple_default_comment_label;
$comments_title = '%1$s %2$s %3$s';
@ -53,9 +60,9 @@ function render_block_core_comments_title( $attributes ) {
);
}
/**
* Registers the `core/comments-title` block on the server.
*/
/**
* Registers the `core/comments-title` block on the server.
*/
function register_block_core_comments_title() {
register_block_type_from_metadata(
__DIR__ . '/comments-title',
@ -65,4 +72,4 @@ function register_block_core_comments_title() {
);
}
add_action( 'init', 'register_block_core_comments_title' );
add_action( 'init', 'register_block_core_comments_title' );

View File

@ -40,7 +40,7 @@ function render_block_core_cover( $attributes, $content ) {
$object_position = '';
if ( isset( $attributes['focalPoint'] ) ) {
$object_position = round( $attributes['focalPoint']['x'] * 100 ) . '%' . ' ' .
round( $attributes['focalPoint']['x'] * 100 ) . '%';
round( $attributes['focalPoint']['y'] * 100 ) . '%';
}
$image_template = '<img

View File

@ -25,10 +25,14 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
ob_start();
comment_form( array(), $block->context['postId'] );
$form = ob_get_clean();
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
// We use the outermost wrapping `<div />` returned by `comment_form()`
// which is identified by its default classname `comment-respond` to inject
// our wrapper attributes. This way, it is guaranteed that all styling applied
@ -70,4 +74,3 @@ function post_comments_form_block_form_defaults( $fields ) {
return $fields;
}
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );

View File

@ -98,8 +98,7 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
)
);
$this->assertEquals(
build_comment_query_vars_from_block( $block ),
$this->assertSameSetsWithIndex(
array(
'orderby' => 'comment_date_gmt',
'order' => 'ASC',
@ -107,7 +106,8 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
'no_found_rows' => false,
'post_id' => self::$custom_post->ID,
'hierarchical' => 'threaded',
)
),
build_comment_query_vars_from_block( $block )
);
update_option( 'page_comments', true );
}
@ -194,25 +194,27 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
)
);
$this->assertEquals(
'<ol class="wp-block-comment-template"><li id="comment-' . self::$comment_ids[0] . '" class="comment even thread-even depth-1"><div class="has-small-font-size wp-block-comment-author-name"><a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div></li></ol>',
$block->render()
$this->assertSame(
str_replace( array( "\n", "\t" ), '', '<ol class="wp-block-comment-template"><li id="comment-' . self::$comment_ids[0] . '" class="comment even thread-even depth-1"><div class="wp-block-comment-author-name"><a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content"><p>Hello world</p></div></li></ol>' ),
str_replace( array( "\n", "\t" ), '', $block->render() )
);
}
/**
* Test rendering 3 nested comments:
* Test rendering nested comments:
*
* └─ comment 1
*   └─ comment 2
*    └─ comment 3
*    └─ comment 4
*   └─ comment 5
*
* @ticket 55567
*/
function test_rendering_comment_template_nested() {
$first_level_ids = self::factory()->comment->create_post_comments(
self::$custom_post->ID,
1,
2,
array(
'comment_parent' => self::$comment_ids[0],
'comment_author' => 'Test',
@ -245,9 +247,63 @@ class Tests_Blocks_RenderReusableCommentTemplate extends WP_UnitTestCase {
)
);
$this->assertEquals(
'<ol class="wp-block-comment-template"><li id="comment-' . self::$comment_ids[0] . '" class="comment odd alt thread-odd thread-alt depth-1"><div class="has-small-font-size wp-block-comment-author-name"><a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div><ol><li id="comment-' . $first_level_ids[0] . '" class="comment even depth-2"><div class="has-small-font-size wp-block-comment-author-name"><a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div><ol><li id="comment-' . $second_level_ids[0] . '" class="comment odd alt depth-3"><div class="has-small-font-size wp-block-comment-author-name"><a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >Test</a></div><div class="wp-block-comment-content">Hello world</div></li></ol></li></ol></li></ol>',
$block->render()
$top_level_ids = self::$comment_ids;
$expected = str_replace(
array( "\n", "\t" ),
'',
<<<END
<ol class="wp-block-comment-template">
<li id="comment-{$top_level_ids[0]}" class="comment odd alt thread-odd thread-alt depth-1">
<div class="wp-block-comment-author-name">
<a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >
Test
</a>
</div>
<div class="wp-block-comment-content">
<p>Hello world</p>
</div>
<ol>
<li id="comment-{$first_level_ids[0]}" class="comment even depth-2">
<div class="wp-block-comment-author-name">
<a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >
Test
</a>
</div>
<div class="wp-block-comment-content">
<p>Hello world</p>
</div>
<ol>
<li id="comment-{$second_level_ids[0]}" class="comment odd alt depth-3">
<div class="wp-block-comment-author-name">
<a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >
Test
</a>
</div>
<div class="wp-block-comment-content">
<p>Hello world</p>
</div>
</li>
</ol>
</li>
<li id="comment-{$first_level_ids[1]}" class="comment even depth-2">
<div class="wp-block-comment-author-name">
<a rel="external nofollow ugc" href="http://example.com/author-url/" target="_self" >
Test
</a>
</div>
<div class="wp-block-comment-content">
<p>Hello world</p>
</div>
</li>
</ol>
</li>
</ol>
END
);
$this->assertSame(
$expected,
str_replace( array( "\n", "\t" ), '', $block->render() )
);
}

View File

@ -54,7 +54,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
buildTarget = buildTarget + '/wp-includes';
const WORDPRESS_NAMESPACE = '@wordpress/';
const BUNDLED_PACKAGES = [ '@wordpress/icons', '@wordpress/interface' ];
const BUNDLED_PACKAGES = [ '@wordpress/icons', '@wordpress/interface', '@wordpress/style-engine' ];
const packages = Object.keys( dependencies )
.filter( ( packageName ) =>
! BUNDLED_PACKAGES.includes( packageName ) &&