Ticket #58756: 58756.3.diff
| File 58756.3.diff, 5.2 KB (added by , 2 years ago) |
|---|
-
src/js/_enqueues/lib/image-edit.js
245 245 }, 246 246 247 247 /** 248 * Observes whether the popup should remain open based on focus position. 249 * 250 * @since 6.4.0 251 * 252 * @memberof imageEdit 253 * 254 * @param {HTMLElement} el The activated control element. 255 * 256 * @return {boolean} Always returns false. 257 */ 258 monitorPopup : function(el) { 259 var $el = $( el ); 260 var $parent = document.querySelector( '.imgedit-rotate-menu-container' ); 261 var $toggle = document.querySelector( '.imgedit-rotate-menu-container .imgedit-rotate' ); 262 263 setTimeout( function() { 264 var $focused = document.activeElement; 265 var $contains = $parent.contains( $focused ); 266 267 // If $focused is defined and not inside the menu container, close the popup. 268 if ( $focused && ! $contains ) { 269 if ( 'true' === $toggle.getAttribute( 'aria-expanded' ) ) { 270 imageEdit.togglePopup( $toggle ); 271 } 272 } 273 }, 100 ); 274 275 return false; 276 }, 277 278 /** 248 279 * Navigate popup menu by arrow keys. 249 280 * 250 281 * @since 6.3.0 -
src/wp-admin/includes/image-edit.php
63 63 <button type="button" onclick="imageEdit.toggleCropTool( <?php echo "$post_id, '$nonce'"; ?>, this );" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button> 64 64 <button type="button" class="imgedit-scale button" onclick="imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-scale"><?php esc_html_e( 'Scale' ); ?></button> 65 65 <div class="imgedit-rotate-menu-container"> 66 <button type="button" aria-controls="imgedit-rotate-menu" class="imgedit-rotate button" aria-expanded="false" onclick="imageEdit.togglePopup(this)" ><?php esc_html_e( 'Image Rotation' ); ?></button>66 <button type="button" aria-controls="imgedit-rotate-menu" class="imgedit-rotate button" aria-expanded="false" onclick="imageEdit.togglePopup(this)" onblur="imageEdit.monitorPopup(this)"><?php esc_html_e( 'Image Rotation' ); ?></button> 67 67 <div id="imgedit-rotate-menu" class="imgedit-popup-menu"> 68 68 <?php 69 69 // On some setups GD library does not provide imagerotate() - Ticket #11536. … … 75 75 ) ) { 76 76 $note_no_rotate = ''; 77 77 ?> 78 <button type="button" class="imgedit-rleft button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" ><?php esc_html_e( 'Rotate 90┬░ left' ); ?></button>79 <button type="button" class="imgedit-rright button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" ><?php esc_html_e( 'Rotate 90┬░ right' ); ?></button>80 <button type="button" class="imgedit-rfull button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(180, <?php echo "$post_id, '$nonce'"; ?>, this)" ><?php esc_html_e( 'Rotate 180┬░' ); ?></button>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(this)"><?php esc_html_e( 'Rotate 90┬░ 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(this)"><?php esc_html_e( 'Rotate 90┬░ 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(this)"><?php esc_html_e( 'Rotate 180┬░' ); ?></button> 81 81 <?php 82 82 } else { 83 83 $note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>'; … … 88 88 } 89 89 ?> 90 90 <hr /> 91 <button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" 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)" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button>91 <button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" onblur="imageEdit.monitorPopup(this)" 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(this)" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button> 93 93 <?php echo $note_no_rotate; ?> 94 94 </div> 95 95 </div>