diff --git a/src/wp-includes/js/media-grid.js b/src/wp-includes/js/media-grid.js index e5a69640ba..0ac6f44c9b 100644 --- a/src/wp-includes/js/media-grid.js +++ b/src/wp-includes/js/media-grid.js @@ -230,7 +230,7 @@ }, addNewClickHandler: function() { - this.trigger( 'show:upload:attachment' ); + this.trigger( 'toggle:upload:attachment' ); }, /** diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 0ffb74bdb2..ae183db7a0 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -5602,7 +5602,8 @@ AttachmentView: media.view.Attachment.Library }); - this.listenTo( this.controller, 'show:upload:attachment', _.bind( this.showUploader, this ) ); + this.listenTo( this.controller, 'toggle:upload:attachment', _.bind( this.toggleUploader, this ) ); + this.createToolbar(); this.createUploader(); this.createAttachments(); @@ -5744,8 +5745,12 @@ this.views.add( this.uploader ); }, - showUploader: function() { - this.uploader.show(); + toggleUploader: function() { + if ( this.uploader.$el.hasClass( 'hidden' ) ) { + this.uploader.show(); + } else { + this.uploader.hide(); + } }, createAttachments: function() {