Ticket #39824: 39824.diff
| File 39824.diff, 3.0 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/js/media/views/frame/post.js
570 570 style: 'primary', 571 571 text: editing ? l10n.updateGallery : l10n.insertGallery, 572 572 priority: 80, 573 requires: { library: true },573 requires: { library: true, uploadingComplete: true }, 574 574 575 575 /** 576 576 * @fires wp.media.controller.State#update -
src/wp-includes/js/media/views/toolbar.js
138 138 } 139 139 140 140 var requires = button.options.requires, 141 disabled = false; 141 disabled = false, 142 modelsUploading = ! _.isEmpty( library.findWhere( { 'uploading': true } ) ); 142 143 143 144 // Prevent insertion of attachments if any of them are still uploading 144 145 disabled = _.some( selection.models, function( attachment ) { … … 145 146 return attachment.get('uploading') === true; 146 147 }); 147 148 149 if ( requires.uploadingComplete && modelsUploading ) { 150 disabled = true; 151 } 152 148 153 if ( requires.selection && selection && ! selection.length ) { 149 154 disabled = true; 150 155 } else if ( requires.library && library && ! library.length ) { -
src/wp-includes/js/media-views.js
5684 5684 style: 'primary', 5685 5685 text: editing ? l10n.updateGallery : l10n.insertGallery, 5686 5686 priority: 80, 5687 requires: { library: true },5687 requires: { library: true, uploadingComplete: true }, 5688 5688 5689 5689 /** 5690 5690 * @fires wp.media.controller.State#update … … 5691 5691 */ 5692 5692 click: function() { 5693 5693 var controller = this.controller, 5694 state = controller.state(); 5694 state = controller.state(), 5695 library = state.get('library'); 5695 5696 5696 5697 controller.close(); 5697 state.trigger( 'update', state.get('library'));5698 state.trigger( 'update', library ); 5698 5699 5699 5700 // Restore and reset the default state. 5700 5701 controller.setState( controller.options.state ); … … 7721 7722 } 7722 7723 7723 7724 var requires = button.options.requires, 7724 disabled = false; 7725 disabled = false, 7726 modelsUploading = ! _.isEmpty( library.findWhere( { 'uploading': true } ) ); 7725 7727 7726 7728 // Prevent insertion of attachments if any of them are still uploading 7727 7729 disabled = _.some( selection.models, function( attachment ) { … … 7728 7730 return attachment.get('uploading') === true; 7729 7731 }); 7730 7732 7733 if ( requires.uploadingComplete && modelsUploading ) { 7734 disabled = true; 7735 } 7736 7731 7737 if ( requires.selection && selection && ! selection.length ) { 7732 7738 disabled = true; 7733 7739 } else if ( requires.library && library && ! library.length ) {