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

@@ -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
);
}