Changeset 59035
- Timestamp:
- 09/17/2024 09:56:43 PM (4 weeks ago)
- Location:
- trunk/src/js/media/views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/media/views/attachment.js
r57515 r59035 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 -
trunk/src/js/media/views/modal.js
r52242 r59035 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.7 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. … … 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 });
Note: See TracChangeset
for help on using the changeset viewer.