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 3
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovere after WordPress 6.0 Beta 2. Props zieladam, ndiego. See #55567. git-svn-id: https://develop.svn.wordpress.org/trunk@53278 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
911
package-lock.json
generated
911
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@@ -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",
|
||||
@@ -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",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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 ) );
|
||||
|
||||
@@ -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 ) );
|
||||
|
||||
@@ -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
|
||||
@@ -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 ) ) {
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
68
src/wp-includes/blocks/comments-title.php
Normal file
68
src/wp-includes/blocks/comments-title.php
Normal file
@@ -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
src/wp-includes/blocks/comments-title/block.json
Normal file
70
src/wp-includes/blocks/comments-title/block.json
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ require ABSPATH . WPINC . '/blocks/comments-pagination-next.php';
|
||||
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';
|
||||
@@ -38,6 +39,7 @@ require ABSPATH . WPINC . '/blocks/pattern.php';
|
||||
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';
|
||||
|
||||
73
src/wp-includes/blocks/post-comments-form.php
Normal file
73
src/wp-includes/blocks/post-comments-form.php
Normal file
@@ -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' );
|
||||
43
src/wp-includes/blocks/post-comments-form/block.json
Normal file
43
src/wp-includes/blocks/post-comments-form/block.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2,
|
||||
"name": "core/post-comments-form",
|
||||
"title": "Post Comments Form",
|
||||
"category": "theme",
|
||||
"description": "Display a post's comments form.",
|
||||
"textdomain": "default",
|
||||
"attributes": {
|
||||
"textAlign": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"usesContext": [ "postId", "postType" ],
|
||||
"supports": {
|
||||
"html": false,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
"text": true
|
||||
}
|
||||
},
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"lineHeight": true,
|
||||
"__experimentalFontStyle": true,
|
||||
"__experimentalFontWeight": true,
|
||||
"__experimentalLetterSpacing": true,
|
||||
"__experimentalTextTransform": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"editorStyle": "wp-block-post-comments-form-editor",
|
||||
"style": [
|
||||
"wp-block-post-comments-form",
|
||||
"wp-block-buttons",
|
||||
"wp-block-button"
|
||||
]
|
||||
}
|
||||
@@ -40,5 +40,6 @@
|
||||
"wp-block-post-comments",
|
||||
"wp-block-buttons",
|
||||
"wp-block-button"
|
||||
]
|
||||
],
|
||||
"editorStyle": "wp-block-post-comments-editor"
|
||||
}
|
||||
|
||||
@@ -317,6 +317,7 @@ function _unhook_block_registration() {
|
||||
remove_action( 'init', 'register_block_core_comments_pagination_next' );
|
||||
remove_action( 'init', 'register_block_core_comments_pagination_numbers' );
|
||||
remove_action( 'init', 'register_block_core_comments_pagination_previous' );
|
||||
remove_action( 'init', 'register_block_core_comments_title' );
|
||||
remove_action( 'init', 'register_block_core_cover' );
|
||||
remove_action( 'init', 'register_block_core_file' );
|
||||
remove_action( 'init', 'register_block_core_gallery' );
|
||||
@@ -334,6 +335,7 @@ function _unhook_block_registration() {
|
||||
remove_action( 'init', 'register_block_core_post_author' );
|
||||
remove_action( 'init', 'register_block_core_post_author_biography' );
|
||||
remove_action( 'init', 'register_block_core_post_comments' );
|
||||
remove_action( 'init', 'register_block_core_post_comments_form' );
|
||||
remove_action( 'init', 'register_block_core_post_content' );
|
||||
remove_action( 'init', 'register_block_core_post_date' );
|
||||
remove_action( 'init', 'register_block_core_post_excerpt' );
|
||||
|
||||
@@ -34,6 +34,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
|
||||
'comment-reply-link',
|
||||
'comment-template',
|
||||
'comments-pagination',
|
||||
'comments-title',
|
||||
'comments-pagination-next',
|
||||
'comments-pagination-numbers',
|
||||
'comments-pagination-previous',
|
||||
@@ -53,6 +54,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
|
||||
'post-author',
|
||||
'post-author-biography',
|
||||
'post-comments',
|
||||
'post-comments-form',
|
||||
'post-content',
|
||||
'post-date',
|
||||
'post-excerpt',
|
||||
|
||||
Reference in New Issue
Block a user