Make WordPress Core

Ticket #60548: 60548.2.diff

File 60548.2.diff, 4.2 KB (added by joedolson, 6 months ago)

Update PR to include JS changes & pass event.

  • src/js/_enqueues/lib/image-edit.js

     
    299299         *
    300300         * @memberof imageEdit
    301301         *
     302         * @param {Event} event The key or click event.
    302303         * @param {HTMLElement} el The current element.
    303304         *
    304305         * @return {boolean} Always returns false.
    305306         */
    306         browsePopup : function(el) {
     307        browsePopup : function(event, el) {
    307308                var $el = $( el );
    308309                var $collection = $( el ).parent( '.imgedit-popup-menu' ).find( 'button' );
    309310                var $index = $collection.index( $el );
     
    316317                if ( $next === $last ) {
    317318                        $next = 0;
    318319                }
    319                 var $target = false;
     320                var target = false;
    320321                if ( event.keyCode === 40 ) {
    321                         $target = $collection.get( $next );
     322                        target = $collection.get( $next );
    322323                } else if ( event.keyCode === 38 ) {
    323                         $target = $collection.get( $prev );
     324                        target = $collection.get( $prev );
    324325                }
    325                 if ( $target ) {
    326                         $target.focus();
     326                if ( target ) {
     327                        target.focus();
    327328                        event.preventDefault();
    328329                }
    329330
  • src/wp-admin/includes/image-edit.php

     
    7575                        ) ) {
    7676                                $note_no_rotate = '';
    7777                                ?>
    78                                         <button type="button" class="imgedit-rleft button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; left' ); ?></button>
    79                                         <button type="button" class="imgedit-rright button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; right' ); ?></button>
    80                                         <button type="button" class="imgedit-rfull button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(180, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 180&deg;' ); ?></button>
     78                                        <button type="button" class="imgedit-rleft button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; left' ); ?></button>
     79                                        <button type="button" class="imgedit-rright button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 90&deg; right' ); ?></button>
     80                                        <button type="button" class="imgedit-rfull button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.rotate(180, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e( 'Rotate 180&deg;' ); ?></button>
    8181                                <?php
    8282                        } else {
    8383                                $note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
     
    8888                        }
    8989                        ?>
    9090                                        <hr />
    91                                         <button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button>
    92                                         <button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>
     91                                        <button type="button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button>
     92                                        <button type="button" onkeydown="imageEdit.browsePopup(event, this)" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup()" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>
    9393                                        <?php echo $note_no_rotate; ?>
    9494                                </div>
    9595                        </div>