Ticket #60369: 60369-2.patch
| File 60369-2.patch, 1.8 KB (added by , 2 years ago) |
|---|
-
src/js/media/views/attachment.js
199 199 method = 'toggle'; 200 200 } 201 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 } 206 202 207 this.toggleSelection({ 203 208 method: method 204 209 }); -
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 if ( 'insert' === this.controller.options.state ) { 198 this.controller.trigger( 'insert', selection ); 199 } else { 200 this.controller.trigger( 'select', selection ); 201 event.preventDefault(); 202 this.escape(); 203 } 204 }, 205 206 /** 184 207 * @param {Array|Object} content Views to register to '.media-modal-content' 185 208 * @return {wp.media.view.Modal} Returns itself to allow chaining. 186 209 */ … … 214 237 this.escape(); 215 238 event.stopImmediatePropagation(); 216 239 } 240 241 // Select the attachment when command or control and enter are pressed. 242 if ( ( 13 === event.which || 10 === event.which ) && ( event.metaKey || event.ctrlKey ) ) { 243 this.selectHandler( event ); 244 event.stopImmediatePropagation(); 245 } 246 217 247 } 218 248 }); 219 249