Make WordPress Core

Ticket #36925: 36925.4.diff

File 36925.4.diff, 2.9 KB (added by adamsilverstein, 5 years ago)
  • src/js/_enqueues/wp/media/views.js

    diff --git src/js/_enqueues/wp/media/views.js src/js/_enqueues/wp/media/views.js
    index 01b8d00c42..76c79e0b63 100644
    media.view.SiteIconCropper = require( '../../../media/views/site-icon-cropper.js 
    151151media.view.SiteIconPreview = require( '../../../media/views/site-icon-preview.js' );
    152152media.view.EditImage = require( '../../../media/views/edit-image.js' );
    153153media.view.Spinner = require( '../../../media/views/spinner.js' );
     154media.view.Heading = require( '../../../media/views/heading.js' );
  • src/js/media/views/attachments/browser.js

    diff --git src/js/media/views/attachments/browser.js src/js/media/views/attachments/browser.js
    index 0f4561b062..92f8387ce8 100644
    AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro 
    6161                 */
    6262                this.createToolbar();
    6363
     64                // Add a heading before the attachments list.
     65                this.createAttachmentsHeading();
     66
    6467                // Create the list of attachments.
    6568                this.createAttachments();
    6669
    AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro 
    407410                }
    408411        },
    409412
     413        createAttachmentsHeading: function() {
     414                this.attachmentsHeading = new wp.media.view.Heading( {
     415                        text: l10n.attachmentsList,
     416                        level: 'h2',
     417                        className: 'media-views-heading screen-reader-text'
     418                } );
     419                this.views.add( this.attachmentsHeading );
     420        },
     421
    410422        createSidebar: function() {
    411423                var options = this.options,
    412424                        selection = options.selection,
  • new file src/js/media/views/heading.js

    diff --git src/js/media/views/heading.js src/js/media/views/heading.js
    new file mode 100644
    index 0000000000..9c8c80be5e
    - +  
     1/**
     2 * wp.media.view.Heading
     3 *
     4 * A reusable heading component for the media library
     5 *
     6 * Used to add accessibility friendly headers in the media library/modal.
     7 *
     8 * @class
     9 * @augments wp.media.View
     10 * @augments wp.Backbone.View
     11 * @augments Backbone.View
     12 */
     13var Heading = wp.media.View.extend( {
     14        tagName: function() {
     15                return this.options.level || 'h1';
     16        },
     17        className: 'media-views-heading',
     18
     19        initialize: function() {
     20
     21                if ( this.options.className ) {
     22                        this.$el.addClass( this.options.className );
     23                }
     24
     25                this.text = this.options.text;
     26        },
     27
     28        render: function() {
     29                this.$el.html( this.text );
     30                return this;
     31        }
     32} );
     33
     34module.exports = Heading;
  • src/wp-includes/media.php

    diff --git src/wp-includes/media.php src/wp-includes/media.php
    index db150ab975..bb2e0b8e27 100644
    function wp_enqueue_media( $args = array() ) { 
    37623762                'updateVideoPlaylist'         => __( 'Update video playlist' ),
    37633763                'addToVideoPlaylist'          => __( 'Add to video playlist' ),
    37643764                'addToVideoPlaylistTitle'     => __( 'Add to Video Playlist' ),
     3765
     3766                // Headings
     3767                'attachmentsList'             => __( 'Attachments list' ),
    37653768        );
    37663769
    37673770        /**