Changeset 29443
- Timestamp:
- 08/07/2014 10:32:58 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-grid.js
r29434 r29443 267 267 routes: { 268 268 'upload.php?item=:slug': 'showItem', 269 'upload.php?search=:query': 'search', 270 ':default': 'defaultRoute' 269 'upload.php?search=:query': 'search' 271 270 }, 272 271 … … 278 277 // Respond to the search route by filling the search field and trigggering the input event 279 278 search: function( query ) { 280 // Ensure modal closed, see back button281 this.closeModal();282 279 $( '#media-search-input' ).val( query ).trigger( 'input' ); 283 280 }, … … 287 284 var library = media.frame.state().get('library'); 288 285 289 // Remove existing modal if present290 this.closeModal();291 286 // Trigger the media frame to open the correct item 292 287 media.frame.trigger( 'edit:attachment', library.findWhere( { id: parseInt( query, 10 ) } ) ); 293 },294 295 // Close the modal if set up296 closeModal: function() {297 if ( media.frame.modal ) {298 media.frame.modal.close();299 }300 },301 302 // Default route: make sure the modal and search are reset303 defaultRoute: function() {304 this.closeModal();305 $( '#media-search-input' ).val( '' ).trigger( 'input' );306 288 } 307 289 }); … … 345 327 346 328 this.gridRouter = this.options.gridRouter; 329 347 330 this.library = this.options.library; 348 331
Note: See TracChangeset
for help on using the changeset viewer.