Make WordPress Core

Ticket #39516: 39516.diff

File 39516.diff, 2.0 KB (added by MatheusGimenez, 6 years ago)

I've fixed the bug using conditionals according to the model.id of the object, if it's library, load the sidebar first, if not, load the uploader and attachments first.

  • src/wp-includes/js/media/views/attachments/browser.js

     
    4141                this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this );
    4242                this.controller.on( 'edit:selection', this.editSelection );
    4343                this.createToolbar();
    44                 this.createUploader();
    45                 this.createAttachments();
    46                 if ( this.options.sidebar ) {
    47                         this.createSidebar();
     44                // if its open in wp-admin/upload.php show sidebar first
     45                if ( this.model.id == 'library' ) {
     46                        if ( this.options.sidebar ) {
     47                                this.createSidebar();
     48                        }
     49                        this.createUploader();
     50                        this.createAttachments();
     51                } else {
     52                        // if its open inside a modal (not in wp-admin/upload.php ) show uploader and attachments first
     53                        this.createUploader();
     54                        this.createAttachments();
     55                        if ( this.options.sidebar ) {
     56                                this.createSidebar();
     57                        }
    4858                }
    4959                this.updateContent();
    5060
  • src/wp-includes/js/media-views.js

     
    37723772                this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this );
    37733773                this.controller.on( 'edit:selection', this.editSelection );
    37743774                this.createToolbar();
    3775                 this.createUploader();
    3776                 this.createAttachments();
    3777                 if ( this.options.sidebar ) {
    3778                         this.createSidebar();
     3775                // if its open in wp-admin/upload.php show sidebar first
     3776                if ( this.model.id == 'library' ) {
     3777                        if ( this.options.sidebar ) {
     3778                                this.createSidebar();
     3779                        }
     3780                        this.createUploader();
     3781                        this.createAttachments();
     3782                } else {
     3783                        // if its open inside a modal (not in wp-admin/upload.php ) show uploader and attachments first
     3784                        this.createUploader();
     3785                        this.createAttachments();
     3786                        if ( this.options.sidebar ) {
     3787                                this.createSidebar();
     3788                        }
    37793789                }
    37803790                this.updateContent();
    37813791