Make WordPress Core


Ignore:
Timestamp:
10/21/2025 07:11:53 AM (3 months ago)
Author:
ellatrix
Message:

Editor: update packages.

Updates the packages to match Gutenberg version 21.9.0 RC2.

Also updates the sync script to work with the new package-lock.json format.
Some reusable block tests were adjusted to work with more render arguments.
Added core-data to the ignore list for verify:source-maps because Yjs has been bundled by accident. To be removed in a follow-up. See https://core.trac.wordpress.org/ticket/64120. See https://github.com/WordPress/gutenberg/pull/72503.

See: https://github.com/WordPress/wordpress-develop/pull/10355.
See: https://core.trac.wordpress.org/ticket/64117.

Props ellatrix, dmsnell.
Fixes #64117.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/categories.php

    r59148 r61009  
    100100function build_dropdown_script_block_core_categories( $dropdown_id ) {
    101101    ob_start();
     102
     103    $exports = array( $dropdown_id, home_url() );
    102104    ?>
    103105    <script>
    104     ( function() {
    105         var dropdown = document.getElementById( '<?php echo esc_js( $dropdown_id ); ?>' );
    106         function onCatChange() {
    107             if ( dropdown.options[ dropdown.selectedIndex ].value !== -1 ) {
    108                 location.href = "<?php echo esc_url( home_url() ); ?>/?" + dropdown.name + '=' + dropdown.options[ dropdown.selectedIndex ].value;
     106    ( ( [ 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;
    109113            }
    110         }
    111         dropdown.onchange = onCatChange;
    112     })();
     114        } );
     115    } )( <?php echo wp_json_encode( $exports, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?> );
    113116    </script>
    114117    <?php
    115     return wp_get_inline_script_tag( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) );
     118    return wp_get_inline_script_tag(
     119        trim( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) ) .
     120        "\n//# sourceURL=" . rawurlencode( __FUNCTION__ )
     121    );
    116122}
    117123
Note: See TracChangeset for help on using the changeset viewer.