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 6.3 RC2 #4892

Closed
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
744 changes: 372 additions & 372 deletions package-lock.json

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,64 +79,64 @@
"@emotion/is-prop-valid": "0.8.8",
"@emotion/memoize": "0.7.4",
"@wordpress/a11y": "3.35.1",
"@wordpress/annotations": "2.35.5",
"@wordpress/annotations": "2.35.6",
"@wordpress/api-fetch": "6.32.1",
"@wordpress/autop": "3.35.1",
"@wordpress/blob": "3.35.1",
"@wordpress/block-directory": "4.12.10",
"@wordpress/block-editor": "12.3.8",
"@wordpress/block-library": "8.12.10",
"@wordpress/block-directory": "4.12.12",
"@wordpress/block-editor": "12.3.10",
"@wordpress/block-library": "8.12.12",
"@wordpress/block-serialization-default-parser": "4.35.1",
"@wordpress/blocks": "12.12.4",
"@wordpress/commands": "0.6.8",
"@wordpress/components": "25.1.8",
"@wordpress/compose": "6.12.1",
"@wordpress/core-commands": "0.4.8",
"@wordpress/core-data": "6.12.8",
"@wordpress/customize-widgets": "4.12.10",
"@wordpress/data": "9.5.4",
"@wordpress/data-controls": "3.4.4",
"@wordpress/blocks": "12.12.6",
"@wordpress/commands": "0.6.9",
"@wordpress/components": "25.1.9",
"@wordpress/compose": "6.12.2",
"@wordpress/core-commands": "0.4.10",
"@wordpress/core-data": "6.12.10",
"@wordpress/customize-widgets": "4.12.12",
"@wordpress/data": "9.5.5",
"@wordpress/data-controls": "3.4.5",
"@wordpress/date": "4.35.1",
"@wordpress/deprecated": "3.35.1",
"@wordpress/dom": "3.35.1",
"@wordpress/dom-ready": "3.35.1",
"@wordpress/edit-post": "7.12.10",
"@wordpress/edit-site": "5.12.10",
"@wordpress/edit-widgets": "5.12.10",
"@wordpress/editor": "13.12.8",
"@wordpress/edit-post": "7.12.12",
"@wordpress/edit-site": "5.12.12",
"@wordpress/edit-widgets": "5.12.12",
"@wordpress/editor": "13.12.10",
"@wordpress/element": "5.12.1",
"@wordpress/escape-html": "2.35.1",
"@wordpress/format-library": "4.12.8",
"@wordpress/format-library": "4.12.10",
"@wordpress/hooks": "3.35.1",
"@wordpress/html-entities": "3.35.1",
"@wordpress/i18n": "4.35.1",
"@wordpress/icons": "9.26.2",
"@wordpress/interface": "5.12.8",
"@wordpress/interface": "5.12.9",
"@wordpress/is-shallow-equal": "4.35.1",
"@wordpress/keyboard-shortcuts": "4.12.4",
"@wordpress/keyboard-shortcuts": "4.12.5",
"@wordpress/keycodes": "3.35.1",
"@wordpress/list-reusable-blocks": "4.12.8",
"@wordpress/list-reusable-blocks": "4.12.9",
"@wordpress/media-utils": "4.26.1",
"@wordpress/notices": "4.3.4",
"@wordpress/nux": "7.1.1",
"@wordpress/plugins": "6.3.8",
"@wordpress/preferences": "3.12.8",
"@wordpress/notices": "4.3.5",
"@wordpress/nux": "7.1.2",
"@wordpress/plugins": "6.3.9",
"@wordpress/preferences": "3.12.9",
"@wordpress/preferences-persistence": "1.27.1",
"@wordpress/primitives": "3.33.1",
"@wordpress/priority-queue": "2.35.1",
"@wordpress/private-apis": "0.17.2",
"@wordpress/redux-routine": "4.35.1",
"@wordpress/reusable-blocks": "4.12.8",
"@wordpress/rich-text": "6.12.5",
"@wordpress/reusable-blocks": "4.12.10",
"@wordpress/rich-text": "6.12.6",
"@wordpress/router": "0.4.2",
"@wordpress/server-side-render": "4.12.8",
"@wordpress/server-side-render": "4.12.10",
"@wordpress/shortcode": "3.35.1",
"@wordpress/style-engine": "1.18.1",
"@wordpress/token-list": "2.35.1",
"@wordpress/url": "3.36.1",
"@wordpress/viewport": "5.12.4",
"@wordpress/viewport": "5.12.5",
"@wordpress/warning": "2.35.1",
"@wordpress/widgets": "3.12.8",
"@wordpress/widgets": "3.12.10",
"@wordpress/wordcount": "3.35.1",
"backbone": "1.4.1",
"clipboard": "2.0.11",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

2 changes: 2 additions & 0 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.
*
* @since 6.3.0 Changed render_block_context priority to `1`.
*
* @global int $comment_depth
*
* @param WP_Comment[] $comments The array of comments.
Expand Down
134 changes: 134 additions & 0 deletions src/wp-includes/blocks/footnotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Renders the `core/footnotes` block on the server.
*
* @since 6.3.0
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
Expand Down Expand Up @@ -57,6 +59,8 @@ function render_block_core_footnotes( $attributes, $content, $block ) {

/**
* Registers the `core/footnotes` block on the server.
*
* @since 6.3.0
*/
function register_block_core_footnotes() {
foreach ( array( 'post', 'page' ) as $post_type ) {
Expand All @@ -78,3 +82,133 @@ function register_block_core_footnotes() {
);
}
add_action( 'init', 'register_block_core_footnotes' );

/**
* Saves the footnotes meta value to the revision.
*
* @since 6.3.0
*
* @param int $revision_id The revision ID.
*/
function wp_save_footnotes_meta( $revision_id ) {
$post_id = wp_is_post_revision( $revision_id );

if ( $post_id ) {
$footnotes = get_post_meta( $post_id, 'footnotes', true );

if ( $footnotes ) {
// Can't use update_post_meta() because it doesn't allow revisions.
update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
}
}
}
add_action( 'wp_after_insert_post', 'wp_save_footnotes_meta' );

/**
* Keeps track of the revision ID for "rest_after_insert_{$post_type}".
*
* @since 6.3.0
*
* @global int $wp_temporary_footnote_revision_id The footnote revision ID.
*
* @param int $revision_id The revision ID.
*/
function wp_keep_footnotes_revision_id( $revision_id ) {
global $wp_temporary_footnote_revision_id;
$wp_temporary_footnote_revision_id = $revision_id;
}
add_action( '_wp_put_post_revision', 'wp_keep_footnotes_revision_id' );

/**
* This is a specific fix for the REST API. The REST API doesn't update
* the post and post meta in one go (through `meta_input`). While it
* does fix the `wp_after_insert_post` hook to be called correctly after
* updating meta, it does NOT fix hooks such as post_updated and
* save_post, which are normally also fired after post meta is updated
* in `wp_insert_post()`. Unfortunately, `wp_save_post_revision` is
* added to the `post_updated` action, which means the meta is not
* available at the time, so we have to add it afterwards through the
* `"rest_after_insert_{$post_type}"` action.
*
* @since 6.3.0
*
* @global int $wp_temporary_footnote_revision_id The footnote revision ID.
*
* @param WP_Post $post The post object.
*/
function wp_add_footnotes_revisions_to_post_meta( $post ) {
global $wp_temporary_footnote_revision_id;

if ( $wp_temporary_footnote_revision_id ) {
$revision = get_post( $wp_temporary_footnote_revision_id );

if ( ! $revision ) {
return;
}

$post_id = $revision->post_parent;

// Just making sure we're updating the right revision.
if ( $post->ID === $post_id ) {
$footnotes = get_post_meta( $post_id, 'footnotes', true );

if ( $footnotes ) {
// Can't use update_post_meta() because it doesn't allow revisions.
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', $footnotes );
}
}
}
}

foreach ( array( 'post', 'page' ) as $post_type ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this support all post types using the block editor and/or have revision support enabled?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this conversation / issue may be related:
WordPress/gutenberg#52812

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' );
}

/**
* Restores the footnotes meta value from the revision.
*
* @since 6.3.0
*
* @param int $post_id The post ID.
* @param int $revision_id The revision ID.
*/
function wp_restore_footnotes_from_revision( $post_id, $revision_id ) {
$footnotes = get_post_meta( $revision_id, 'footnotes', true );

if ( $footnotes ) {
update_post_meta( $post_id, 'footnotes', $footnotes );
} else {
delete_post_meta( $post_id, 'footnotes' );
}
}
add_action( 'wp_restore_post_revision', 'wp_restore_footnotes_from_revision', 10, 2 );

/**
* Adds the footnotes field to the revision.
*
* @since 6.3.0
*
* @param array $fields The revision fields.
* @return array The revision fields.
*/
function wp_add_footnotes_to_revision( $fields ) {
$fields['footnotes'] = __( 'Footnotes' );
return $fields;
}
add_filter( '_wp_post_revision_fields', 'wp_add_footnotes_to_revision' );

/**
* Gets the footnotes field from the revision.
*
* @since 6.3.0
*
* @param string $revision_field The field value, but $revision->$field
* (footnotes) does not exist.
* @param string $field The field name, in this case "footnotes".
* @param object $revision The revision object to compare against.
* @return string The field value.
*/
function wp_get_footnotes_from_revision( $revision_field, $field, $revision ) {
return get_metadata( 'post', $revision->ID, $field, true );
}
add_filter( 'wp_post_revision_field_footnotes', 'wp_get_footnotes_from_revision', 10, 3 );
2 changes: 2 additions & 0 deletions src/wp-includes/blocks/pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ function register_block_core_pattern() {
/**
* Renders the `core/pattern` block on the server.
*
* @since 6.3.0 Backwards compatibility: blocks with no `syncStatus` attribute do not receive block wrapper.
*
* @param array $attributes Block attributes.
*
* @return string Returns the output of the pattern.
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/blocks/post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
/**
* Renders the `core/post-template` block on the server.
*
* @since 6.3.0 Changed render_block_context priority to `1`.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/blocks/post-title.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Renders the `core/post-title` block on the server.
*
* @since 6.3.0 Omitting the $post argument from the `get_the_title`.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/blocks/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Dynamically renders the `core/search` block.
*
* @since 6.3.0 Using block.json `viewScript` to register script, and update `view_script_handles()` only when needed.
*
* @param array $attributes The block attributes.
* @param string $content The saved content.
* @param WP_Block $block The parsed block.
Expand Down
Loading