diff --git a/src/js/media/views/frame/post.js b/src/js/media/views/frame/post.js index 064c024cf4..08b32bb0cc 100644 --- a/src/js/media/views/frame/post.js +++ b/src/js/media/views/frame/post.js @@ -580,7 +580,7 @@ Post = Select.extend(/** @lends wp.media.view.MediaFrame.Post.prototype */{ style: 'primary', text: editing ? l10n.updateGallery : l10n.insertGallery, priority: 80, - requires: { library: true }, + requires: { library: true, uploadingComplete: true }, /** * @fires wp.media.controller.State#update diff --git a/src/js/media/views/toolbar.js b/src/js/media/views/toolbar.js index ec1b31aec3..339441879c 100644 --- a/src/js/media/views/toolbar.js +++ b/src/js/media/views/toolbar.js @@ -143,7 +143,8 @@ Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{ } var requires = button.options.requires, - disabled = false; + disabled = false, + modelsUploading = ! _.isEmpty( library.findWhere( { 'uploading': true } ) ); // Prevent insertion of attachments if any of them are still uploading. if ( selection && selection.models ) { @@ -151,6 +152,9 @@ Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{ return attachment.get('uploading') === true; }); } + if ( requires.uploadingComplete && modelsUploading ) { + disabled = true; + } if ( requires.selection && selection && ! selection.length ) { disabled = true;