Make WordPress Core

Changeset 60031


Ignore:
Timestamp:
03/17/2025 05:46:51 PM (5 weeks ago)
Author:
adamsilverstein
Message:

Media: disable "Insert Gallery" button during uploads.

Ensure that the button to insert a gallery is disabled until all image uploads have completed on the Edit Gallery screen. Prevents an issue where users could insert a gallery with some images missing.

Props: adamsilverstein, gonom9, rishavdutta.
Fixes: #39824.

Location:
trunk/src/js/media/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/views/frame/post.js

    r47122 r60031  
    581581                    text:     editing ? l10n.updateGallery : l10n.insertGallery,
    582582                    priority: 80,
    583                     requires: { library: true },
     583                    requires: { library: true, uploadingComplete: true },
    584584
    585585                    /**
  • trunk/src/js/media/views/toolbar.js

    r57987 r60031  
    144144
    145145            var requires = button.options.requires,
    146                 disabled = false;
     146                disabled = false,
     147                modelsUploading = ! _.isEmpty( library.findWhere(  { 'uploading': true } ) );
    147148
    148149            // Prevent insertion of attachments if any of them are still uploading.
     
    151152                    return attachment.get('uploading') === true;
    152153                });
     154            }
     155            if ( requires.uploadingComplete && modelsUploading ) {
     156                disabled = true;
    153157            }
    154158
Note: See TracChangeset for help on using the changeset viewer.