Avoid JS errors after [29057].
See #24716. git-svn-id: https://develop.svn.wordpress.org/trunk@29068 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e91f5a7601
commit
6d64d05018
@ -140,9 +140,10 @@
|
|||||||
this.bindHandlers();
|
this.bindHandlers();
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
|
this.gridRouter = new media.view.Frame.Router( this );
|
||||||
|
|
||||||
// Set up the Backbone router after a brief delay
|
// Set up the Backbone router after a brief delay
|
||||||
_.delay( function(){
|
_.delay( function(){
|
||||||
wp.media.mediarouter = new media.view.Frame.Router( self );
|
|
||||||
// Verify pushState support and activate
|
// Verify pushState support and activate
|
||||||
if ( window.history && window.history.pushState ) {
|
if ( window.history && window.history.pushState ) {
|
||||||
Backbone.history.start({
|
Backbone.history.start({
|
||||||
@ -153,9 +154,12 @@
|
|||||||
}, 250);
|
}, 250);
|
||||||
|
|
||||||
// Update the URL when entering search string (at most once per second)
|
// Update the URL when entering search string (at most once per second)
|
||||||
$( '#media-search-input' ).on( 'input', _.debounce( function() {
|
$( '#media-search-input' ).on( 'input', _.debounce( function(e) {
|
||||||
var $val = $( this ).val();
|
var val = $( e.currentTarget ).val(), url = '';
|
||||||
wp.media.mediarouter.navigate( wp.media.mediarouter.baseUrl( ( '' === $val ) ? '' : ( '?search=' + $val ) ) );
|
if ( val ) {
|
||||||
|
url += '?search=' + val;
|
||||||
|
}
|
||||||
|
self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
|
||||||
}, 1000 ) );
|
}, 1000 ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -240,6 +244,7 @@
|
|||||||
|
|
||||||
// Create a new EditAttachment frame, passing along the library and the attachment model.
|
// Create a new EditAttachment frame, passing along the library and the attachment model.
|
||||||
this.editAttachmentFrame = new media.view.Frame.EditAttachments({
|
this.editAttachmentFrame = new media.view.Frame.EditAttachments({
|
||||||
|
router: this.gridRouter,
|
||||||
library: library,
|
library: library,
|
||||||
model: model
|
model: model
|
||||||
});
|
});
|
||||||
@ -299,7 +304,12 @@
|
|||||||
template: wp.template( 'attachment-details-two-column' ),
|
template: wp.template( 'attachment-details-two-column' ),
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.$el.attr('aria-label', this.model.attributes.title).attr('aria-checked', false);
|
if ( ! this.model ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$el.attr('aria-label', this.model.get( 'title' ) ).attr( 'aria-checked', false );
|
||||||
|
|
||||||
this.model.on( 'change:sizes change:uploading', this.render, this );
|
this.model.on( 'change:sizes change:uploading', this.render, this );
|
||||||
this.model.on( 'change:title', this._syncTitle, this );
|
this.model.on( 'change:title', this._syncTitle, this );
|
||||||
this.model.on( 'change:caption', this._syncCaption, this );
|
this.model.on( 'change:caption', this._syncCaption, this );
|
||||||
@ -403,6 +413,7 @@
|
|||||||
state: 'edit-attachment'
|
state: 'edit-attachment'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.gridRouter = this.options.gridRouter;
|
||||||
this.library = this.options.library;
|
this.library = this.options.library;
|
||||||
if ( this.options.model ) {
|
if ( this.options.model ) {
|
||||||
this.model = this.options.model;
|
this.model = this.options.model;
|
||||||
@ -475,7 +486,7 @@
|
|||||||
});
|
});
|
||||||
this.content.set( view );
|
this.content.set( view );
|
||||||
// Update browser url when navigating media details
|
// Update browser url when navigating media details
|
||||||
wp.media.mediarouter.navigate( wp.media.mediarouter.baseUrl( '?item=' + this.model.id ) );
|
this.gridRouter.navigate( this.gridRouter.baseUrl( '?item=' + this.model.id ) );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -586,8 +597,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
resetRoute: function() {
|
resetRoute: function() {
|
||||||
wp.media.mediarouter.navigate( wp.media.mediarouter.baseUrl( '' ) );
|
this.gridRouter.navigate( this.gridRouter.baseUrl( '' ) );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user