mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
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:
File diff suppressed because one or more lines are too long
@@ -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>',
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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' );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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' );
|
||||
|
||||
Reference in New Issue
Block a user