--- a/wp/wp-admin/js/widgets/media-widgets.js Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/js/widgets/media-widgets.js Mon Oct 14 18:28:13 2019 +0200
@@ -1,4 +1,13 @@
+/**
+ * @output wp-admin/js/widgets/media-widgets.js
+ */
+
/* eslint consistent-this: [ "error", "control" ] */
+
+/**
+ * @namespace wp.mediaWidgets
+ * @memberOf wp
+ */
wp.mediaWidgets = ( function( $ ) {
'use strict';
@@ -9,6 +18,8 @@
*
* Media widgets register themselves by assigning subclasses of MediaWidgetControl onto this object by widget ID base.
*
+ * @memberOf wp.mediaWidgets
+ *
* @type {Object.<string, wp.mediaWidgets.MediaWidgetModel>}
*/
component.controlConstructors = {};
@@ -18,22 +29,22 @@
*
* Media widgets register themselves by assigning subclasses of MediaWidgetControl onto this object by widget ID base.
*
+ * @memberOf wp.mediaWidgets
+ *
* @type {Object.<string, wp.mediaWidgets.MediaWidgetModel>}
*/
component.modelConstructors = {};
- /**
- * Library which persists the customized display settings across selections.
- *
- * @class PersistentDisplaySettingsLibrary
- * @constructor
- */
- component.PersistentDisplaySettingsLibrary = wp.media.controller.Library.extend({
+ component.PersistentDisplaySettingsLibrary = wp.media.controller.Library.extend(/** @lends wp.mediaWidgets.PersistentDisplaySettingsLibrary.prototype */{
/**
- * Initialize.
+ * Library which persists the customized display settings across selections.
+ *
+ * @constructs wp.mediaWidgets.PersistentDisplaySettingsLibrary
+ * @augments wp.media.controller.Library
*
* @param {Object} options - Options.
+ *
* @returns {void}
*/
initialize: function initialize( options ) {
@@ -79,10 +90,10 @@
/**
* Extended view for managing the embed UI.
*
- * @class MediaEmbedView
- * @constructor
+ * @class wp.mediaWidgets.MediaEmbedView
+ * @augments wp.media.view.Embed
*/
- component.MediaEmbedView = wp.media.view.Embed.extend({
+ component.MediaEmbedView = wp.media.view.Embed.extend(/** @lends wp.mediaWidgets.MediaEmbedView.prototype */{
/**
* Initialize.
@@ -109,6 +120,9 @@
* @returns {void}
*/
refresh: function refresh() {
+ /**
+ * @class wp.mediaWidgets~Constructor
+ */
var Constructor;
if ( 'image' === this.controller.options.mimeType ) {
@@ -116,7 +130,7 @@
} else {
// This should be eliminated once #40450 lands of when this is merged into core.
- Constructor = wp.media.view.EmbedLink.extend({
+ Constructor = wp.media.view.EmbedLink.extend(/** @lends wp.mediaWidgets~Constructor.prototype */{
/**
* Set the disabled state on the Add to Widget button.
@@ -284,10 +298,10 @@
/**
* Custom media frame for selecting uploaded media or providing media by URL.
*
- * @class MediaFrameSelect
- * @constructor
+ * @class wp.mediaWidgets.MediaFrameSelect
+ * @augments wp.media.view.MediaFrame.Post
*/
- component.MediaFrameSelect = wp.media.view.MediaFrame.Post.extend({
+ component.MediaFrameSelect = wp.media.view.MediaFrame.Post.extend(/** @lends wp.mediaWidgets.MediaFrameSelect.prototype */{
/**
* Create the default states.
@@ -357,6 +371,8 @@
/**
* Handle click.
*
+ * @ignore
+ *
* @fires wp.media.controller.State#insert()
* @returns {void}
*/
@@ -408,14 +424,7 @@
}
});
- /**
- * Media widget control.
- *
- * @class MediaWidgetControl
- * @constructor
- * @abstract
- */
- component.MediaWidgetControl = Backbone.View.extend({
+ component.MediaWidgetControl = Backbone.View.extend(/** @lends wp.mediaWidgets.MediaWidgetControl.prototype */{
/**
* Translation strings.
@@ -473,12 +482,17 @@
showDisplaySettings: true,
/**
- * Initialize.
+ * Media Widget Control.
+ *
+ * @constructs wp.mediaWidgets.MediaWidgetControl
+ * @augments Backbone.View
+ * @abstract
*
* @param {Object} options - Options.
* @param {Backbone.Model} options.model - Model.
* @param {jQuery} options.el - Control field container element.
* @param {jQuery} options.syncContainer - Container element where fields are synced for the server.
+ *
* @returns {void}
*/
initialize: function initialize( options ) {
@@ -961,10 +975,10 @@
/**
* Media widget model.
*
- * @class MediaWidgetModel
- * @constructor
+ * @class wp.mediaWidgets.MediaWidgetModel
+ * @augments Backbone.Model
*/
- component.MediaWidgetModel = Backbone.Model.extend({
+ component.MediaWidgetModel = Backbone.Model.extend(/** @lends wp.mediaWidgets.MediaWidgetModel.prototype */{
/**
* Id attribute.
@@ -1085,15 +1099,19 @@
/**
* Collection of all widget model instances.
*
+ * @memberOf wp.mediaWidgets
+ *
* @type {Backbone.Collection}
*/
- component.modelCollection = new ( Backbone.Collection.extend({
+ component.modelCollection = new ( Backbone.Collection.extend( {
model: component.MediaWidgetModel
}) )();
/**
* Mapping of widget ID to instances of MediaWidgetControl subclasses.
*
+ * @memberOf wp.mediaWidgets
+ *
* @type {Object.<string, wp.mediaWidgets.MediaWidgetControl>}
*/
component.widgetControls = {};
@@ -1101,8 +1119,11 @@
/**
* Handle widget being added or initialized for the first time at the widget-added event.
*
+ * @memberOf wp.mediaWidgets
+ *
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
+ *
* @returns {void}
*/
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
@@ -1184,6 +1205,8 @@
/**
* Setup widget in accessibility mode.
*
+ * @memberOf wp.mediaWidgets
+ *
* @returns {void}
*/
component.setupAccessibleMode = function setupAccessibleMode() {
@@ -1233,8 +1256,11 @@
* the widgets admin screen and also via the 'widget-synced' event when making
* a change to a widget in the customizer.
*
+ * @memberOf wp.mediaWidgets
+ *
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
+ *
* @returns {void}
*/
component.handleWidgetUpdated = function handleWidgetUpdated( event, widgetContainer ) {
@@ -1267,6 +1293,8 @@
* When WordPress enqueues this script, it should have an inline script
* attached which calls wp.mediaWidgets.init().
*
+ * @memberOf wp.mediaWidgets
+ *
* @returns {void}
*/
component.init = function init() {