Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/media/views/attachment-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AttachmentCompat = View.extend(/** @lends wp.media.view.AttachmentCompat.prototy
return View.prototype.dispose.apply( this, arguments );
},
/**
* @return {wp.media.view.AttachmentCompat} Returns itself to allow chaining.
* @return {void|wp.media.view.AttachmentCompat} Returns itself to allow chaining.
*/
render: function() {
var compat = this.model.get('compat');
Expand Down
36 changes: 30 additions & 6 deletions src/js/media/views/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
this.listenTo( this.controller.states, 'attachment:compat:waiting attachment:compat:ready', this.updateSave );
},
/**
* Update the view after the model has been saved.
*
* @return {wp.media.view.Attachment} Returns itself to allow chaining.
*/
dispose: function() {
Expand All @@ -97,6 +99,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
return this;
},
/**
* Renders the attachment view.
*
* @return {wp.media.view.Attachment} Returns itself to allow chaining.
*/
render: function() {
Expand Down Expand Up @@ -167,6 +171,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
},

/**
* Toggles the selection state of the attachment.
*
* @param {Object} event
*/
toggleSelectionHandler: function( event ) {
Expand Down Expand Up @@ -221,6 +227,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
this.controller.trigger( 'selection:toggle' );
},
/**
* Toggles the selection state of the attachment.
*
* @param {Object} options
*/
toggleSelection: function( options ) {
Expand Down Expand Up @@ -301,7 +309,9 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
this[ this.selected() ? 'select' : 'deselect' ]();
},
/**
* @return {unresolved|boolean}
* Checks if the model is selected in the selection.
*
* @return {void|boolean} True if the model is selected in the selection, false otherwise.
*/
selected: function() {
var selection = this.options.selection;
Expand All @@ -310,6 +320,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
}
},
/**
* Selects the model in the selection.
*
* @param {Backbone.Model} model
* @param {Backbone.Collection} collection
*/
Expand Down Expand Up @@ -339,6 +351,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
}
},
/**
* Deselects the model in the selection.
*
* @param {Backbone.Model} model
* @param {Backbone.Collection} collection
*/
Expand All @@ -357,6 +371,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
.find( '.check' ).attr( 'tabindex', '-1' );
},
/**
* Updates the view to reflect whether the model is the single model in the selection.
*
* @param {Backbone.Model} model
* @param {Backbone.Collection} collection
*/
Expand All @@ -372,8 +388,10 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
this.$el.toggleClass( 'details', details === this.model );
},
/**
* Gets the image size object for the specified size.
*
* @param {string} size
* @return {Object}
* @return {Object} Returns an object containing the image size information.
*/
imageSize: function( size ) {
var sizes = this.model.get('sizes'), matched = false;
Expand Down Expand Up @@ -405,6 +423,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
};
},
/**
* Update the model's setting with the value from the input.
*
* @param {Object} event
*/
updateSetting: function( event ) {
Expand Down Expand Up @@ -456,6 +476,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
});
},
/**
* Updates the view's save status.
*
* @param {string} status
* @return {wp.media.view.Attachment} Returns itself to allow chaining.
*/
Expand Down Expand Up @@ -498,6 +520,8 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
}
},
/**
* Removes the model from the collection.
*
* @param {Object} event
*/
removeFromLibrary: function( event ) {
Expand All @@ -513,11 +537,11 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{
},

/**
* Add the model if it isn't in the selection, if it is in the selection,
* remove it.
* Adds the model if it isn't in the selection, if it is in the selection,
* removes it.
*
* @param {[type]} event [description]
* @return {[type]} [description]
* @param {Object} event
* @return {void}
*/
checkClickHandler: function ( event ) {
var selection = this.options.selection;
Expand Down
2 changes: 0 additions & 2 deletions src/js/media/views/attachment/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ Details = Attachment.extend(/** @lends wp.media.view.Attachment.Details.prototyp
*
* @since 5.5.0
*
* @param {MouseEvent} event A click event.
*
* @return {void}
*/
copyAttachmentDetailsURLClipboard: function() {
Expand Down
2 changes: 1 addition & 1 deletion src/js/media/views/attachments/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var View = wp.media.View,
* @augments wp.Backbone.View
* @augments Backbone.View
*
* @param {object} [options] The options hash passed to the view.
* @param {Object} [options] The options hash passed to the view.
* @param {boolean|string} [options.filters=false] Which filters to show in the browser's toolbar.
* Accepts 'uploaded' and 'all'.
* @param {boolean} [options.search=true] Whether to show the search interface in the
Expand Down
4 changes: 3 additions & 1 deletion src/js/media/views/button-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ ButtonGroup = wp.media.View.extend(/** @lends wp.media.view.ButtonGroup.prototyp
},

/**
* @return {wp.media.view.ButtonGroup}
* Renders the button group.
*
* @return {wp.media.view.ButtonGroup} The button group.
*/
render: function() {
this.$el.html( $( _.pluck( this.buttons, 'el' ) ).detach() );
Expand Down
4 changes: 3 additions & 1 deletion src/js/media/views/embed/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ EmbedUrl = View.extend(/** @lends wp.media.view.EmbedUrl.prototype */{
}
},
/**
* @return {wp.media.view.EmbedUrl} Returns itself to allow chaining.
* Renders the view.
*
* @return {void|wp.media.view.EmbedUrl} Returns itself to allow chaining.
*/
render: function() {
var $input = this.$input;
Expand Down
2 changes: 0 additions & 2 deletions src/js/media/views/focus-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ var FocusManager = wp.media.View.extend(/** @lends wp.media.view.FocusManager.pr
*
* @since 5.3.0
*
* @param {Object} event jQuery event object.
*
* @return {void}
*/
setupAriaTabs: function() {
Expand Down
14 changes: 9 additions & 5 deletions src/js/media/views/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
},
/**
* Map activeMode collection events to the frame.
*
* @param {Backbone.Model} model
* @param {Backbone.Collection} collection
* @param {Object} options
*/
triggerModeEvents: function( model, collection, options ) {
var collectionEvent,
Expand All @@ -113,8 +117,8 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
/**
* Activate a mode on the frame.
*
* @param string mode Mode ID.
* @return {this} Returns itself to allow chaining.
* @param {string} mode Mode ID.
* @return {void|this} Returns itself to allow chaining.
*/
activateMode: function( mode ) {
// Bail if the mode is already active.
Expand All @@ -130,7 +134,7 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
/**
* Deactivate a mode on the frame.
*
* @param string mode Mode ID.
* @param {string} mode Mode ID.
* @return {this} Returns itself to allow chaining.
*/
deactivateMode: function( mode ) {
Expand All @@ -152,8 +156,8 @@ var Frame = wp.media.View.extend(/** @lends wp.media.view.Frame.prototype */{
/**
* Check if a mode is enabled on the frame.
*
* @param string mode Mode ID.
* @return bool
* @param {string} mode Mode ID.
* @return {boolean} True if the mode is active, false otherwise.
*/
isModeActive: function( mode ) {
return Boolean( this.activeModes.where( { id: mode } ).length );
Expand Down
3 changes: 3 additions & 0 deletions src/js/media/views/frame/edit-attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta

/**
* Rerender the view.
* @param {wp.media.model.Attachment} model The attachment model to render.
*/
rerender: function( model ) {
this.stopListening( this.model );
Expand Down Expand Up @@ -285,6 +286,8 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta
* Respond to the keyboard events: Alt + right arrow, Alt + left arrow,
* except when focus is in a form field. Requires the Alt modifier key to
* avoid interfering with screen reader navigation.
*
* @param {Event} event The keyboard event.
*/
keyEvent: function( event ) {
if ( ( 'INPUT' === event.target.nodeName || 'TEXTAREA' === event.target.nodeName || 'SELECT' === event.target.nodeName ) && ! event.target.disabled ) {
Expand Down
4 changes: 4 additions & 0 deletions src/js/media/views/frame/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ Manage = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Manage.prototype

/**
* Click handler for the `Add New` button.
*
* @param {Event} event The click event.
*/
addNewClickHandler: function( event ) {
event.preventDefault();
Expand All @@ -208,6 +210,8 @@ Manage = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Manage.prototype

/**
* Open the Edit Attachment modal.
*
* @param {wp.media.model.Attachment} model The attachment model to edit.
*/
openEditAttachmentModal: function( model ) {
// Create a new EditAttachment frame, passing along the library and the attachment model.
Expand Down
2 changes: 1 addition & 1 deletion src/js/media/views/media-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ MediaDetails = AttachmentDisplay.extend(/** @lends wp.media.view.MediaDetails.pr
* When multiple players in the DOM contain the same src, things get weird.
*
* @param {HTMLElement} elem
* @return {HTMLElement}
* @return {HTMLElement} The prepared element.
*/
prepareSrc : function( elem ) {
var i = MediaDetails.instances++;
Expand Down
2 changes: 1 addition & 1 deletion src/js/media/views/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Menu = PriorityList.extend(/** @lends wp.media.view.Menu.prototype */{
/**
* @param {Object} options
* @param {string} id
* @return {wp.media.View}
* @return {wp.media.View} The view instance.
*/
toView: function( options, id ) {
options = options || {};
Expand Down
20 changes: 19 additions & 1 deletion src/js/media/views/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
});
},
/**
* @return {Object}
* Prepares the data for the modal template.
*
* @return {Object} The prepared data.
*/
prepare: function() {
return {
Expand All @@ -47,6 +49,8 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
},

/**
* Attaches the modal to the DOM and triggers the ready event.
*
* @return {wp.media.view.Modal} Returns itself to allow chaining.
*/
attach: function() {
Expand All @@ -68,6 +72,8 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
},

/**
* Detaches the modal from the DOM and triggers the detach event.
*
* @return {wp.media.view.Modal} Returns itself to allow chaining.
*/
detach: function() {
Expand All @@ -81,6 +87,8 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
},

/**
* Opens the modal and triggers the open event.
*
* @return {wp.media.view.Modal} Returns itself to allow chaining.
*/
open: function() {
Expand Down Expand Up @@ -124,6 +132,8 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
},

/**
* Closes the modal and triggers the close event.
*
* @param {Object} options
* @return {wp.media.view.Modal} Returns itself to allow chaining.
*/
Expand Down Expand Up @@ -167,12 +177,16 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
return this;
},
/**
* Closes the modal and triggers the escape event.
*
* @return {wp.media.view.Modal} Returns itself to allow chaining.
*/
escape: function() {
return this.close({ escape: true });
},
/**
* Handles the escape key press event to close the modal.
*
* @param {Object} event
*/
escapeHandler: function( event ) {
Expand Down Expand Up @@ -204,6 +218,8 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
},

/**
* Sets the content of the modal by registering views to the '.media-modal-content' selector.
*
* @param {Array|Object} content Views to register to '.media-modal-content'
* @return {wp.media.view.Modal} Returns itself to allow chaining.
*/
Expand All @@ -229,6 +245,8 @@ Modal = wp.media.View.extend(/** @lends wp.media.view.Modal.prototype */{
return this;
},
/**
* Handles keydown events within the modal.
*
* @param {Object} event
*/
keydown: function( event ) {
Expand Down
Loading
Loading