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 for WordPress 6.0 Beta 3 #2629

Closed
wants to merge 5 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48,845 changes: 24,487 additions & 24,358 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.1",
"@wordpress/scripts": "22.4.2",
"autoprefixer": "^9.8.8",
"chalk": "4.1.2",
"check-node-version": "4.2.1",
Expand Down Expand Up @@ -81,54 +81,54 @@
"@wordpress/api-fetch": "6.3.1",
"@wordpress/autop": "3.6.1",
"@wordpress/blob": "3.6.1",
"@wordpress/block-directory": "3.4.2",
"@wordpress/block-editor": "8.5.2",
"@wordpress/block-library": "7.3.2",
"@wordpress/block-directory": "3.4.3",
"@wordpress/block-editor": "8.5.3",
"@wordpress/block-library": "7.3.3",
"@wordpress/block-serialization-default-parser": "4.6.1",
"@wordpress/blocks": "11.5.2",
"@wordpress/components": "19.8.1",
"@wordpress/blocks": "11.5.3",
"@wordpress/components": "19.8.2",
"@wordpress/compose": "5.4.1",
"@wordpress/core-data": "4.4.2",
"@wordpress/customize-widgets": "3.3.2",
"@wordpress/core-data": "4.4.3",
"@wordpress/customize-widgets": "3.3.3",
"@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.2",
"@wordpress/edit-site": "4.3.2",
"@wordpress/edit-widgets": "4.3.2",
"@wordpress/editor": "12.5.2",
"@wordpress/edit-post": "6.3.3",
"@wordpress/edit-site": "4.3.3",
"@wordpress/edit-widgets": "4.3.3",
"@wordpress/editor": "12.5.3",
"@wordpress/element": "4.4.1",
"@wordpress/escape-html": "2.6.1",
"@wordpress/format-library": "3.4.2",
"@wordpress/format-library": "3.4.3",
"@wordpress/hooks": "3.6.1",
"@wordpress/html-entities": "3.6.1",
"@wordpress/i18n": "4.6.1",
"@wordpress/icons": "8.2.1",
"@wordpress/interface": "4.5.1",
"@wordpress/icons": "8.2.2",
"@wordpress/interface": "4.5.2",
"@wordpress/is-shallow-equal": "4.6.1",
"@wordpress/keyboard-shortcuts": "3.4.1",
"@wordpress/keycodes": "3.6.1",
"@wordpress/list-reusable-blocks": "3.4.1",
"@wordpress/list-reusable-blocks": "3.4.2",
"@wordpress/media-utils": "3.4.1",
"@wordpress/notices": "3.6.1",
"@wordpress/nux": "5.4.1",
"@wordpress/plugins": "4.4.1",
"@wordpress/preferences": "1.2.1",
"@wordpress/nux": "5.4.2",
"@wordpress/plugins": "4.4.2",
"@wordpress/preferences": "1.2.2",
"@wordpress/primitives": "3.4.1",
"@wordpress/priority-queue": "2.6.1",
"@wordpress/redux-routine": "4.6.1",
"@wordpress/reusable-blocks": "3.4.2",
"@wordpress/reusable-blocks": "3.4.3",
"@wordpress/rich-text": "5.4.1",
"@wordpress/server-side-render": "3.4.2",
"@wordpress/server-side-render": "3.4.3",
"@wordpress/shortcode": "3.6.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.2",
"@wordpress/widgets": "2.4.3",
"@wordpress/wordcount": "3.6.1",
"backbone": "1.4.1",
"clipboard": "2.0.10",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions src/wp-includes/blocks/comment-edit-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ function render_block_core_comment_edit_link( $attributes, $content, $block ) {

$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 ) );
Expand Down
5 changes: 1 addition & 4 deletions src/wp-includes/blocks/comment-reply-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ function render_block_core_comment_reply_link( $attributes, $content, $block ) {

$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 ) );
Expand Down
17 changes: 13 additions & 4 deletions src/wp-includes/blocks/comment-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Function that recursively renders a list of nested comments.
*
* @global int $comment_depth
*
* @param WP_Comment[] $comments The array of comments.
* @param WP_Block $block Block instance.
* @return string
Expand All @@ -31,6 +33,17 @@ function block_core_comment_template_render_comments( $comments, $block ) {

$children = $comment->get_children();

/*
* We need to create the CSS classes BEFORE recursing into the children.
* This is because comment_class() uses globals like `$comment_alt`
* and `$comment_thread_alt` which are order-sensitive.
*
* The `false` parameter at the end means that we do NOT want the function
* to `echo` the output but to return a string.
* See https://developer.wordpress.org/reference/functions/comment_class/#parameters.
*/
$comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false );

// If the comment has children, recurse to create the HTML for the nested
// comments.
if ( ! empty( $children ) ) {
Expand All @@ -43,10 +56,6 @@ function block_core_comment_template_render_comments( $comments, $block ) {
$comment_depth -= 1;
}

// The `false` parameter at the end means that we do NOT want the function to `echo` the output but to return a string.
// See https://developer.wordpress.org/reference/functions/comment_class/#parameters.
$comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false );

$content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );
}

Expand Down
68 changes: 68 additions & 0 deletions src/wp-includes/blocks/comments-title.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Server-side rendering of the `core/comments-title` block.
*
* @package WordPress
*/

/**
* Renders the `core/comments-title` block on the server.
*
* @param array $attributes Block attributes.
*
* @return string Return the post comments title.
*/
function render_block_core_comments_title( $attributes ) {

$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
$show_post_title = ! empty( $attributes['showPostTitle'] ) && $attributes['showPostTitle'];
$show_comments_count = ! empty( $attributes['showCommentsCount'] ) && $attributes['showCommentsCount'];
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
$post_title = $show_post_title ? sprintf( '"%1$s"', get_the_title() ) : null;
$comments_count = number_format_i18n( get_comments_number() );
$tag_name = 'h2';
if ( isset( $attributes['level'] ) ) {
$tag_name = 'h' . $attributes['level'];
}

if ( '0' === $comments_count ) {
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;

$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';

$comments_title = sprintf(
$comments_title,
// If there is only one comment, only display the label.
'1' !== $comments_count && $show_comments_count ? $comments_count : null,
'1' === $comments_count ? $single_comment_label : $multiple_comment_label,
$post_title
);

return sprintf(
'<%1$s id="comments" %2$s>%3$s</%1$s>',
$tag_name,
$wrapper_attributes,
$comments_title
);
}

/**
* Registers the `core/comments-title` block on the server.
*/
function register_block_core_comments_title() {
register_block_type_from_metadata(
__DIR__ . '/comments-title',
array(
'render_callback' => 'render_block_core_comments_title',
)
);
}

add_action( 'init', 'register_block_core_comments_title' );
70 changes: 70 additions & 0 deletions src/wp-includes/blocks/comments-title/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/comments-title",
"title": "Comments Title",
"category": "theme",
"ancestor": [ "core/comments-query-loop" ],
"description": "Displays a title with the number of comments",
"textdomain": "default",
"usesContext": [ "postId", "postType" ],
"attributes": {
"textAlign": {
"type": "string"
},
"singleCommentLabel": {
"type": "string"
},
"multipleCommentsLabel": {
"type": "string"
},
"showPostTitle": {
"type": "boolean",
"default": true
},
"showCommentsCount": {
"type": "boolean",
"default": true
},
"level": {
"type": "number",
"default": 2
}
},
"supports": {
"anchor": false,
"align": true,
"html": false,
"__experimentalBorder": {
"radius": true,
"color": true,
"width": true,
"style": true
},
"color": {
"gradients": true,
"__experimentalDefaultControls": {
"background": true,
"text": true
}
},
"spacing": {
"margin": true,
"padding": true
},
"typography": {
"fontSize": true,
"lineHeight": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true,
"__experimentalFontFamily": true,
"__experimentalTextTransform": true,
"__experimentalDefaultControls": {
"fontSize": true,
"__experimentalFontFamily": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true
}
}
}
}
2 changes: 2 additions & 0 deletions src/wp-includes/blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require ABSPATH . WPINC . '/blocks/comments-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/comments-pagination.php';
require ABSPATH . WPINC . '/blocks/comments-title.php';
require ABSPATH . WPINC . '/blocks/cover.php';
require ABSPATH . WPINC . '/blocks/file.php';
require ABSPATH . WPINC . '/blocks/gallery.php';
Expand All @@ -38,6 +39,7 @@
require ABSPATH . WPINC . '/blocks/post-author-biography.php';
require ABSPATH . WPINC . '/blocks/post-author.php';
require ABSPATH . WPINC . '/blocks/post-comments.php';
require ABSPATH . WPINC . '/blocks/post-comments-form.php';
require ABSPATH . WPINC . '/blocks/post-content.php';
require ABSPATH . WPINC . '/blocks/post-date.php';
require ABSPATH . WPINC . '/blocks/post-excerpt.php';
Expand Down
73 changes: 73 additions & 0 deletions src/wp-includes/blocks/post-comments-form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* Server-side rendering of the `core/post-comments-form` block.
*
* @package WordPress
*/

/**
* Renders the `core/post-comments-form` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Returns the filtered post comments form for the current post.
*/
function render_block_core_post_comments_form( $attributes, $content, $block ) {
if ( ! isset( $block->context['postId'] ) ) {
return '';
}

$classes = 'comment-respond'; // See comment further below.
if ( isset( $attributes['textAlign'] ) ) {
$classes .= 'has-text-align-' . $attributes['textAlign'];
}

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

ob_start();
comment_form( array(), $block->context['postId'] );
$form = ob_get_clean();

// 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
// to the block is carried along when the comment form is moved to the location
// of the 'Reply' link that the user clicked by Core's `comment-reply.js` script.
$form = str_replace( 'class="comment-respond"', $wrapper_attributes, $form );

// Enqueue the comment-reply script.
wp_enqueue_script( 'comment-reply' );

return $form;
}

/**
* Registers the `core/post-comments-form` block on the server.
*/
function register_block_core_post_comments_form() {
register_block_type_from_metadata(
__DIR__ . '/post-comments-form',
array(
'render_callback' => 'render_block_core_post_comments_form',
)
);
}
add_action( 'init', 'register_block_core_post_comments_form' );

/**
* Use the button block classes for the form-submit button.
*
* @param array $fields The default comment form arguments.
*
* @return array Returns the modified fields.
*/
function post_comments_form_block_form_defaults( $fields ) {
if ( wp_is_block_theme() ) {
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
}

return $fields;
}
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
Loading