Source: media/views/heading.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
 * wp.media.view.Heading
 *
 * A reusable heading component for the media library
 *
 * Used to add accessibility friendly headers in the media library/modal.
 *
 * @class
 * @augments wp.media.View
 * @augments wp.Backbone.View
 * @augments Backbone.View
 */
var Heading = wp.media.View.extend( {
    tagName: function() {
        return this.options.level || 'h1';
    },
    className: 'media-views-heading',

    initialize: function() {

        if ( this.options.className ) {
            this.$el.addClass( this.options.className );
        }

        this.text = this.options.text;
    },

    render: function() {
        this.$el.html( this.text );
        return this;
    }
} );

module.exports = Heading;