Skip to content
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
242 changes: 121 additions & 121 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,32 @@
"@wordpress/autop": "4.33.1",
"@wordpress/base-styles": "6.9.1",
"@wordpress/blob": "4.33.1",
"@wordpress/block-directory": "5.33.3",
"@wordpress/block-editor": "15.6.1",
"@wordpress/block-library": "9.33.2",
"@wordpress/block-directory": "5.33.5",
"@wordpress/block-editor": "15.6.3",
"@wordpress/block-library": "9.33.4",
"@wordpress/block-serialization-default-parser": "5.33.1",
"@wordpress/blocks": "15.6.1",
"@wordpress/commands": "1.33.1",
"@wordpress/components": "30.6.1",
"@wordpress/compose": "7.33.1",
"@wordpress/core-commands": "1.33.1",
"@wordpress/core-data": "7.33.1",
"@wordpress/customize-widgets": "5.33.2",
"@wordpress/core-commands": "1.33.3",
"@wordpress/core-data": "7.33.3",
"@wordpress/customize-widgets": "5.33.4",
"@wordpress/data": "10.33.1",
"@wordpress/data-controls": "4.33.1",
"@wordpress/dataviews": "10.1.1",
"@wordpress/dataviews": "10.1.2",
"@wordpress/date": "5.33.1",
"@wordpress/deprecated": "4.33.1",
"@wordpress/dom": "4.33.1",
"@wordpress/dom-ready": "4.33.1",
"@wordpress/edit-post": "8.33.3",
"@wordpress/edit-site": "6.33.3",
"@wordpress/edit-widgets": "6.33.2",
"@wordpress/editor": "14.33.3",
"@wordpress/edit-post": "8.33.5",
"@wordpress/edit-site": "6.33.5",
"@wordpress/edit-widgets": "6.33.4",
"@wordpress/editor": "14.33.5",
"@wordpress/element": "6.33.1",
"@wordpress/escape-html": "3.33.1",
"@wordpress/fields": "0.25.3",
"@wordpress/format-library": "5.33.1",
"@wordpress/fields": "0.25.5",
"@wordpress/format-library": "5.33.3",
"@wordpress/hooks": "4.33.1",
"@wordpress/html-entities": "4.33.1",
"@wordpress/i18n": "6.6.1",
Expand All @@ -123,15 +123,15 @@
"@wordpress/media-utils": "5.33.1",
"@wordpress/notices": "5.33.1",
"@wordpress/nux": "9.33.1",
"@wordpress/patterns": "2.33.1",
"@wordpress/patterns": "2.33.3",
"@wordpress/plugins": "7.33.1",
"@wordpress/preferences": "4.33.1",
"@wordpress/preferences-persistence": "2.33.1",
"@wordpress/primitives": "4.33.1",
"@wordpress/priority-queue": "3.33.1",
"@wordpress/private-apis": "1.33.1",
"@wordpress/redux-routine": "5.33.1",
"@wordpress/reusable-blocks": "5.33.1",
"@wordpress/reusable-blocks": "5.33.3",
"@wordpress/rich-text": "7.33.1",
"@wordpress/router": "1.33.1",
"@wordpress/server-side-render": "6.9.1",
Expand All @@ -143,9 +143,9 @@
"@wordpress/upload-media": "0.18.1",
"@wordpress/url": "4.33.1",
"@wordpress/viewport": "6.33.1",
"@wordpress/views": "1.0.2",
"@wordpress/views": "1.0.3",
"@wordpress/warning": "3.33.1",
"@wordpress/widgets": "4.33.1",
"@wordpress/widgets": "4.33.3",
"@wordpress/wordcount": "4.33.1",
"backbone": "1.6.0",
"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: 1 addition & 1 deletion src/wp-includes/blocks/accordion-heading/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "core/accordion-heading",
"title": "Accordion Heading",
"category": "design",
"description": "Toggles the accordion panel.",
"description": "Displays a heading that toggles the accordion panel.",
"parent": [ "core/accordion-item" ],
"usesContext": [
"core/accordion-icon-position",
Expand Down
54 changes: 53 additions & 1 deletion src/wp-includes/blocks/archives.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ function render_block_core_archives( $attributes ) {
$show_label = empty( $attributes['showLabel'] ) ? ' screen-reader-text' : '';

$block_content = '<label for="' . $dropdown_id . '" class="wp-block-archives__label' . $show_label . '">' . esc_html( $title ) . '</label>
<select id="' . $dropdown_id . '" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
<select id="' . esc_attr( $dropdown_id ) . '" name="archive-dropdown">
<option value="">' . esc_html( $label ) . '</option>' . $archives . '</select>';

// Inject the dropdown script immediately after the select dropdown.
$block_content .= block_core_archives_build_dropdown_script( $dropdown_id );

return sprintf(
'<div %1$s>%2$s</div>',
$wrapper_attributes,
Expand Down Expand Up @@ -106,6 +109,55 @@ function render_block_core_archives( $attributes ) {
);
}

/**
* Generates the inline script for an archives dropdown field.
*
* @since 6.9.0
*
* @param string $dropdown_id ID of the dropdown field.
*
* @return string Returns the dropdown onChange redirection script.
Comment on lines +117 to +119
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param string $dropdown_id ID of the dropdown field.
*
* @return string Returns the dropdown onChange redirection script.
* @param string $dropdown_id ID of the dropdown field.
* @return string Returns the dropdown onChange redirection script.

Copy link
Author

Choose a reason for hiding this comment

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

What's the objective reason to remove the blank line? It passes the coding standard checks, and other PHPDocs in the same file have had the same blank line for years

Copy link
Member

Choose a reason for hiding this comment

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

I concur with @priethor here, no need to remove that line as most (all?) cases here include the line spacing (and at least for me makes it easier to read those docs/comments).

Copy link
Member

Choose a reason for hiding this comment

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

It's not a blocker but as per WordPress Inline Documentation Standards for PHP, there should not be an extra line between @param and @return tags.

Copy link
Member

Choose a reason for hiding this comment

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

I concur with @priethor here, no need to remove that line as most (all?) cases here include the line spacing (and at least for me makes it easier to read those docs/comments).

@jeffpaul In that case we should update the PHPCS document.

Copy link
Member

Choose a reason for hiding this comment

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

This can be done in a follow-up PR for Gutenberg, along with the change mentioned below.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed that any such change should be done in Gutenberg, starting with updating the PHPCS rules to match the coding standards.

*/
function block_core_archives_build_dropdown_script( $dropdown_id ) {
ob_start();

$exports = array( $dropdown_id, home_url() );
?>
<script>
( ( [ dropdownId, homeUrl ] ) => {
const dropdown = document.getElementById( dropdownId );
function onSelectChange() {
setTimeout( () => {
if ( 'escape' === dropdown.dataset.lastkey ) {
return;
}
if ( dropdown.value ) {
location.href = dropdown.value;
}
}, 250 );
}
function onKeyUp( event ) {
if ( 'Escape' === event.key ) {
dropdown.dataset.lastkey = 'escape';
} else {
delete dropdown.dataset.lastkey;
}
}
function onClick() {
delete dropdown.dataset.lastkey;
}
dropdown.addEventListener( 'keyup', onKeyUp );
dropdown.addEventListener( 'click', onClick );
dropdown.addEventListener( 'change', onSelectChange );
} )( <?php echo wp_json_encode( $exports, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> );
</script>
<?php
return wp_get_inline_script_tag(
trim( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) ) .
"\n//# sourceURL=" . rawurlencode( __FUNCTION__ )
);
Comment on lines +155 to +158
Copy link
Member

Choose a reason for hiding this comment

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

Should we use wp_remove_surrounding_empty_script_tags here? cc. @westonruter

Copy link
Member

Choose a reason for hiding this comment

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

Yes, although it's not important. It can be done in a follow-up PR to Gutenberg.

}

/**
* Register archives block.
*
Expand Down
11 changes: 9 additions & 2 deletions src/wp-includes/blocks/blocks-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
'name' => 'core/accordion-heading',
'title' => 'Accordion Heading',
'category' => 'design',
'description' => 'Toggles the accordion panel.',
'description' => 'Displays a heading that toggles the accordion panel.',
'parent' => array(
'core/accordion-item'
),
Expand Down Expand Up @@ -2516,9 +2516,13 @@
)
),
'supports' => array(
'html' => false,
'className' => false,
'customClassName' => false,
'reusable' => false
'lock' => false,
'reusable' => false,
'renaming' => false,
'blockVisibility' => false
),
'editorStyle' => 'wp-block-freeform-editor'
),
Expand Down Expand Up @@ -3825,7 +3829,10 @@
'customClassName' => false,
'inserter' => false,
'html' => false,
'lock' => false,
'reusable' => false,
'renaming' => false,
'blockVisibility' => false,
'interactivity' => array(
'clientNavigation' => true
)
Expand Down
32 changes: 25 additions & 7 deletions src/wp-includes/blocks/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,32 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
?>
<script>
( ( [ dropdownId, homeUrl ] ) => {
document.getElementById( dropdownId ).addEventListener( 'change', ( event ) => {
const dropdown = /** @type {HTMLSelectElement} */ ( event.target );
if ( dropdown.value && dropdown.value !== '-1' ) {
const url = new URL( homeUrl );
url.searchParams.set( dropdown.name, dropdown.value );
location.href = url.href;
const dropdown = document.getElementById( dropdownId );
function onSelectChange() {
setTimeout( () => {
if ( 'escape' === dropdown.dataset.lastkey ) {
return;
}
if ( dropdown.value && dropdown instanceof HTMLSelectElement ) {
const url = new URL( homeUrl );
url.searchParams.set( dropdown.name, dropdown.value );
location.href = url.href;
}
}, 250 );
}
function onKeyUp( event ) {
if ( 'Escape' === event.key ) {
dropdown.dataset.lastkey = 'escape';
} else {
delete dropdown.dataset.lastkey;
}
} );
}
function onClick() {
delete dropdown.dataset.lastkey;
}
dropdown.addEventListener( 'keyup', onKeyUp );
dropdown.addEventListener( 'click', onClick );
dropdown.addEventListener( 'change', onSelectChange );
} )( <?php echo wp_json_encode( $exports, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> );
</script>
<?php
Expand Down
6 changes: 5 additions & 1 deletion src/wp-includes/blocks/freeform/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
}
},
"supports": {
"html": false,
"className": false,
"customClassName": false,
"reusable": false
"lock": false,
"reusable": false,
"renaming": false,
"blockVisibility": false
},
"editorStyle": "wp-block-freeform-editor"
}
3 changes: 3 additions & 0 deletions src/wp-includes/blocks/missing/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"customClassName": false,
"inserter": false,
"html": false,
"lock": false,
"reusable": false,
"renaming": false,
"blockVisibility": false,
"interactivity": {
"clientNavigation": true
}
Expand Down
Loading