Ticket #60369: 60369.patch
File 60369.patch, 1.8 KB (added by , 9 months ago) |
---|
-
src/js/media/views/attachment.js
198 198 } else if ( event.ctrlKey || event.metaKey ) { 199 199 method = 'toggle'; 200 200 } 201 202 // Avoid toggles when the command or control key is pressed with the enter key to prevent deselecting the last selected attachment. 203 if( ( event.metaKey || event.ctrlKey ) && ( 13 === event.keyCode || 10 === event.keyCode ) ){ 204 return; 205 } 201 206 202 207 this.toggleSelection({ 203 208 method: method -
src/js/media/views/modal.js
181 181 }, 182 182 183 183 /** 184 * Handles the selection of attachments when the command or control key is pressed with the enter key. 185 * 186 * @since 6.6 187 * 188 * @param {Object} event The keydown event object. 189 */ 190 selectHandler: function( event ) { 191 var selection = this.controller.state().get( 'selection' ); 192 193 if ( ! selection.length > 0 ) { 194 return; 195 } 196 197 this.controller.trigger( 'select', selection ); 198 event.preventDefault(); 199 this.escape(); 200 }, 201 202 /** 184 203 * @param {Array|Object} content Views to register to '.media-modal-content' 185 204 * @return {wp.media.view.Modal} Returns itself to allow chaining. 186 205 */ … … 214 233 this.escape(); 215 234 event.stopImmediatePropagation(); 216 235 } 236 237 // Select the attachment when command or control and enter are pressed. 238 if ( ( 13 === event.which || 10 === event.which ) && ( event.metaKey || event.ctrlKey ) ) { 239 this.selectHandler( event ); 240 event.stopImmediatePropagation(); 241 } 217 242 } 218 243 }); 219 244