frame.js
6 years ago
item-preview.js
8 years ago
item-setting-field.js
8 years ago
item-settings.js
8 years ago
sidebar.js
8 years ago
frame.js
47 lines
| 1 | /** |
| 2 | * wp.media.view.MediaFrame.MenuIcons |
| 3 | * |
| 4 | * @class |
| 5 | * @augments wp.media.view.MediaFrame.IconPicker |
| 6 | * @augments wp.media.view.MediaFrame.Select |
| 7 | * @augments wp.media.view.MediaFrame |
| 8 | * @augments wp.media.view.Frame |
| 9 | * @augments wp.media.View |
| 10 | * @augments wp.Backbone.View |
| 11 | * @augments Backbone.View |
| 12 | */ |
| 13 | |
| 14 | var MenuIcons = wp.media.view.MediaFrame.IconPicker.extend({ |
| 15 | initialize: function() { |
| 16 | this.menuItems = new Backbone.Collection([], { |
| 17 | model: wp.media.model.MenuIconsItem |
| 18 | }); |
| 19 | |
| 20 | wp.media.view.MediaFrame.IconPicker.prototype.initialize.apply( this, arguments ); |
| 21 | if(this.setMenuTabPanelAriaAttributes){ |
| 22 | this.off( 'open', this.setMenuTabPanelAriaAttributes, this ); |
| 23 | // Set the router ARIA tab panel attributes when the modal opens. |
| 24 | this.off( 'open', this.setRouterTabPanelAriaAttributes, this ); |
| 25 | |
| 26 | // Update the menu ARIA tab panel attributes when the content updates. |
| 27 | this.off( 'content:render', this.setMenuTabPanelAriaAttributes, this ); |
| 28 | // Update the router ARIA tab panel attributes when the content updates. |
| 29 | this.off( 'content:render', this.setRouterTabPanelAriaAttributes, this ); |
| 30 | } |
| 31 | this.listenTo( this.target, 'change', this.miUpdateItemProps ); |
| 32 | this.on( 'select', this.miClearTarget, this ); |
| 33 | }, |
| 34 | |
| 35 | miUpdateItemProps: function( props ) { |
| 36 | var model = this.menuItems.get( props.id ); |
| 37 | |
| 38 | model.set( props.changed ); |
| 39 | }, |
| 40 | |
| 41 | miClearTarget: function() { |
| 42 | this.target.clear({ silent: true }); |
| 43 | } |
| 44 | }); |
| 45 | |
| 46 | module.exports = MenuIcons; |
| 47 |