Skip to content

Commit a078909

Browse files
committed
Sync packages for WP 6.9 beta 3.
Changes can be found at https://github.com/WordPress/gutenberg/commits/wp/6.9/. Developed in WordPress/wordpress-develop#10453. See https://make.wordpress.org/core/handbook/about/release-cycle/block-editor-release-process-for-major-releases/#package-updates-and-core-patches. Fixes #64185. Props priethor, mukesh27, jeffpaul, westonruter, desrosj, wildworks. Built from https://develop.svn.wordpress.org/trunk@61125 git-svn-id: https://core.svn.wordpress.org/trunk@60461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 0f761b2 commit a078909

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+953
-697
lines changed

wp-includes/assets/script-loader-packages.min.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

wp-includes/assets/script-loader-packages.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

wp-includes/blocks/accordion-heading/block.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "core/accordion-heading",
55
"title": "Accordion Heading",
66
"category": "design",
7-
"description": "Toggles the accordion panel.",
7+
"description": "Displays a heading that toggles the accordion panel.",
88
"parent": [ "core/accordion-item" ],
99
"usesContext": [
1010
"core/accordion-icon-position",

wp-includes/blocks/accordion-heading/style-rtl.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.wp-block-accordion .wp-block-accordion-heading{
2-
padding:0;
3-
}
4-
51
.wp-block-accordion-heading__toggle{
62
align-items:center;
73
background:none;
@@ -11,6 +7,7 @@
117
display:flex;
128
font-family:inherit;
139
font-size:inherit;
10+
font-style:inherit;
1411
font-weight:inherit;
1512
letter-spacing:inherit;
1613
line-height:inherit;

wp-includes/blocks/accordion-heading/style-rtl.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wp-includes/blocks/accordion-heading/style.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.wp-block-accordion .wp-block-accordion-heading{
2-
padding:0;
3-
}
4-
51
.wp-block-accordion-heading__toggle{
62
align-items:center;
73
background:none;
@@ -11,6 +7,7 @@
117
display:flex;
128
font-family:inherit;
139
font-size:inherit;
10+
font-style:inherit;
1411
font-weight:inherit;
1512
letter-spacing:inherit;
1613
line-height:inherit;

wp-includes/blocks/accordion-heading/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wp-includes/blocks/archives.php

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ function render_block_core_archives( $attributes ) {
6666
$show_label = empty( $attributes['showLabel'] ) ? ' screen-reader-text' : '';
6767

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

72+
// Inject the dropdown script immediately after the select dropdown.
73+
$block_content .= block_core_archives_build_dropdown_script( $dropdown_id );
74+
7275
return sprintf(
7376
'<div %1$s>%2$s</div>',
7477
$wrapper_attributes,
@@ -106,6 +109,55 @@ function render_block_core_archives( $attributes ) {
106109
);
107110
}
108111

112+
/**
113+
* Generates the inline script for an archives dropdown field.
114+
*
115+
* @since 6.9.0
116+
*
117+
* @param string $dropdown_id ID of the dropdown field.
118+
*
119+
* @return string Returns the dropdown onChange redirection script.
120+
*/
121+
function block_core_archives_build_dropdown_script( $dropdown_id ) {
122+
ob_start();
123+
124+
$exports = array( $dropdown_id, home_url() );
125+
?>
126+
<script>
127+
( ( [ dropdownId, homeUrl ] ) => {
128+
const dropdown = document.getElementById( dropdownId );
129+
function onSelectChange() {
130+
setTimeout( () => {
131+
if ( 'escape' === dropdown.dataset.lastkey ) {
132+
return;
133+
}
134+
if ( dropdown.value ) {
135+
location.href = dropdown.value;
136+
}
137+
}, 250 );
138+
}
139+
function onKeyUp( event ) {
140+
if ( 'Escape' === event.key ) {
141+
dropdown.dataset.lastkey = 'escape';
142+
} else {
143+
delete dropdown.dataset.lastkey;
144+
}
145+
}
146+
function onClick() {
147+
delete dropdown.dataset.lastkey;
148+
}
149+
dropdown.addEventListener( 'keyup', onKeyUp );
150+
dropdown.addEventListener( 'click', onClick );
151+
dropdown.addEventListener( 'change', onSelectChange );
152+
} )( <?php echo wp_json_encode( $exports, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> );
153+
</script>
154+
<?php
155+
return wp_get_inline_script_tag(
156+
trim( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) ) .
157+
"\n//# sourceURL=" . rawurlencode( __FUNCTION__ )
158+
);
159+
}
160+
109161
/**
110162
* Register archives block.
111163
*

wp-includes/blocks/blocks-json.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
'name' => 'core/accordion-heading',
105105
'title' => 'Accordion Heading',
106106
'category' => 'design',
107-
'description' => 'Toggles the accordion panel.',
107+
'description' => 'Displays a heading that toggles the accordion panel.',
108108
'parent' => array(
109109
'core/accordion-item'
110110
),
@@ -2516,9 +2516,13 @@
25162516
)
25172517
),
25182518
'supports' => array(
2519+
'html' => false,
25192520
'className' => false,
25202521
'customClassName' => false,
2521-
'reusable' => false
2522+
'lock' => false,
2523+
'reusable' => false,
2524+
'renaming' => false,
2525+
'blockVisibility' => false
25222526
),
25232527
'editorStyle' => 'wp-block-freeform-editor'
25242528
),
@@ -3825,7 +3829,10 @@
38253829
'customClassName' => false,
38263830
'inserter' => false,
38273831
'html' => false,
3832+
'lock' => false,
38283833
'reusable' => false,
3834+
'renaming' => false,
3835+
'blockVisibility' => false,
38293836
'interactivity' => array(
38303837
'clientNavigation' => true
38313838
)

wp-includes/blocks/categories.php

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,32 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
104104
?>
105105
<script>
106106
( ( [ dropdownId, homeUrl ] ) => {
107-
document.getElementById( dropdownId ).addEventListener( 'change', ( event ) => {
108-
const dropdown = /** @type {HTMLSelectElement} */ ( event.target );
109-
if ( dropdown.value && dropdown.value !== '-1' ) {
110-
const url = new URL( homeUrl );
111-
url.searchParams.set( dropdown.name, dropdown.value );
112-
location.href = url.href;
107+
const dropdown = document.getElementById( dropdownId );
108+
function onSelectChange() {
109+
setTimeout( () => {
110+
if ( 'escape' === dropdown.dataset.lastkey ) {
111+
return;
112+
}
113+
if ( dropdown.value && dropdown instanceof HTMLSelectElement ) {
114+
const url = new URL( homeUrl );
115+
url.searchParams.set( dropdown.name, dropdown.value );
116+
location.href = url.href;
117+
}
118+
}, 250 );
119+
}
120+
function onKeyUp( event ) {
121+
if ( 'Escape' === event.key ) {
122+
dropdown.dataset.lastkey = 'escape';
123+
} else {
124+
delete dropdown.dataset.lastkey;
113125
}
114-
} );
126+
}
127+
function onClick() {
128+
delete dropdown.dataset.lastkey;
129+
}
130+
dropdown.addEventListener( 'keyup', onKeyUp );
131+
dropdown.addEventListener( 'click', onClick );
132+
dropdown.addEventListener( 'change', onSelectChange );
115133
} )( <?php echo wp_json_encode( $exports, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> );
116134
</script>
117135
<?php

0 commit comments

Comments
 (0)