Changeset 29076
- Timestamp:
- 07/10/2014 07:38:56 PM (10 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-grid.js
r29074 r29076 217 217 // Handle a frame-level event for editing an attachment. 218 218 this.on( 'edit:attachment', this.editAttachment, this ); 219 this.on( 'edit:attachment:next', this.editNextAttachment, this );220 this.on( 'edit:attachment:previous', this.editPreviousAttachment, this );221 219 }, 222 220 223 221 addNewClickHandler: function() { 224 222 this.trigger( 'show:upload:attachment' ); 225 },226 227 editPreviousAttachment: function( currentModel ) {228 var library = this.state().get('library'),229 currentModelIndex = library.indexOf( currentModel );230 this.trigger( 'edit:attachment', library.at( currentModelIndex - 1 ) );231 },232 233 editNextAttachment: function( currentModel ) {234 var library = this.state().get('library'),235 currentModelIndex = library.indexOf( currentModel );236 this.trigger( 'edit:attachment', library.at( currentModelIndex + 1 ) );237 223 }, 238 224 … … 245 231 246 232 // Create a new EditAttachment frame, passing along the library and the attachment model. 247 this.editAttachmentFrame = new media.view.Frame.EditAttachments({ 233 this.editAttachmentFrame = wp.media( { 234 frame: 'edit-attachments', 248 235 gridRouter: this.gridRouter, 249 236 library: library, 250 237 model: model 251 }); 252 253 // Listen to events on the edit attachment frame for triggering pagination callback handlers. 254 this.listenTo( this.editAttachmentFrame, 'edit:attachment:next', this.editNextAttachment ); 255 this.listenTo( this.editAttachmentFrame, 'edit:attachment:previous', this.editPreviousAttachment ); 238 } ); 239 256 240 // Listen to keyboard events on the modal 257 241 $( 'body' ).on( 'keydown.media-modal', function( e ) { … … 386 370 * Requires an attachment model to be passed in the options hash under `model`. 387 371 */ 388 media.view. Frame.EditAttachments = media.view.Frame.extend({372 media.view.MediaFrame.EditAttachments = media.view.Frame.extend({ 389 373 390 374 className: 'edit-attachment-frame', … … 536 520 }, 537 521 522 resetContent: function() { 523 this.modal.close(); 524 wp.media( { 525 frame: 'edit-attachments', 526 gridRouter: this.gridRouter, 527 library: this.library, 528 model: this.model 529 } ); 530 }, 531 538 532 /** 539 533 * Click handler to switch to the previous media item. … … 543 537 return; 544 538 } 545 this.mod al.close();546 this. trigger( 'edit:attachment:previous', this.model);539 this.model = this.library.at( this.getCurrentIndex() - 1 ); 540 this.resetContent(); 547 541 }, 548 542 … … 554 548 return; 555 549 } 556 this.mod al.close();557 this. trigger( 'edit:attachment:next', this.model);550 this.model = this.library.at( this.getCurrentIndex() + 1 ); 551 this.resetContent(); 558 552 }, 559 553 -
trunk/src/wp-includes/js/media-models.js
r28688 r29076 39 39 } else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) { 40 40 frame = new MediaFrame.VideoDetails( attributes ); 41 } else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) { 42 frame = new MediaFrame.EditAttachments( attributes ); 41 43 } 42 44
Note: See TracChangeset
for help on using the changeset viewer.