mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-23 00:31:28 +01:00
a5478d7adb
* The way that the JS modules for media are currently set up turns the existing global `wp.media` namespace into a read-only API, this is bad. * For the existing module implementation to work with plugins, those looking to override or extend a class would have to modify their own plugin to use `browserify` - we can't expect this to happen * Because the general way that plugins override media classes is via machete (resetting them to something else), we cannot use `require( 'module' )` in the internal code for media modules We CAN continue to use `require( 'fun/js' )` in the manifests for media. Future code/projects should carefully consider what is made to be public API. In 3.5, EVERYTHING was made public, so everything shall remain public. See #31684, #28510. Built from https://develop.svn.wordpress.org/trunk@31935 git-svn-id: http://core.svn.wordpress.org/trunk@31914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
63 lines
2.1 KiB
JavaScript
63 lines
2.1 KiB
JavaScript
/*globals wp, _ */
|
|
|
|
/**
|
|
* wp.media.controller.ImageDetails
|
|
*
|
|
* A state for editing the attachment display settings of an image that's been
|
|
* inserted into the editor.
|
|
*
|
|
* @class
|
|
* @augments wp.media.controller.State
|
|
* @augments Backbone.Model
|
|
*
|
|
* @param {object} [attributes] The attributes hash passed to the state.
|
|
* @param {string} [attributes.id=image-details] Unique identifier.
|
|
* @param {string} [attributes.title=Image Details] Title for the state. Displays in the frame's title region.
|
|
* @param {wp.media.model.Attachment} attributes.image The image's model.
|
|
* @param {string|false} [attributes.content=image-details] Initial mode for the content region.
|
|
* @param {string|false} [attributes.menu=false] Initial mode for the menu region.
|
|
* @param {string|false} [attributes.router=false] Initial mode for the router region.
|
|
* @param {string|false} [attributes.toolbar=image-details] Initial mode for the toolbar region.
|
|
* @param {boolean} [attributes.editing=false] Unused.
|
|
* @param {int} [attributes.priority=60] Unused.
|
|
*
|
|
* @todo This state inherits some defaults from media.controller.Library.prototype.defaults,
|
|
* however this may not do anything.
|
|
*/
|
|
var State = wp.media.controller.State,
|
|
Library = wp.media.controller.Library,
|
|
l10n = wp.media.view.l10n,
|
|
ImageDetails;
|
|
|
|
ImageDetails = State.extend({
|
|
defaults: _.defaults({
|
|
id: 'image-details',
|
|
title: l10n.imageDetailsTitle,
|
|
content: 'image-details',
|
|
menu: false,
|
|
router: false,
|
|
toolbar: 'image-details',
|
|
editing: false,
|
|
priority: 60
|
|
}, Library.prototype.defaults ),
|
|
|
|
/**
|
|
* @since 3.9.0
|
|
*
|
|
* @param options Attributes
|
|
*/
|
|
initialize: function( options ) {
|
|
this.image = options.image;
|
|
State.prototype.initialize.apply( this, arguments );
|
|
},
|
|
|
|
/**
|
|
* @since 3.9.0
|
|
*/
|
|
activate: function() {
|
|
this.frame.modal.$el.addClass('image-details');
|
|
}
|
|
});
|
|
|
|
module.exports = ImageDetails;
|