wp/wp-admin/js/widgets/media-widgets.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-admin/js/widgets/media-widgets.js	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/js/widgets/media-widgets.js	Tue Dec 15 13:49:49 2020 +0100
@@ -45,7 +45,7 @@
 		 *
 		 * @param {Object} options - Options.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		initialize: function initialize( options ) {
 			_.bindAll( this, 'handleDisplaySettingChange' );
@@ -56,7 +56,7 @@
 		 * Sync changes to the current display settings back into the current customized.
 		 *
 		 * @param {Backbone.Model} displaySettings - Modified display settings.
-		 * @returns {void}
+		 * @return {void}
 		 */
 		handleDisplaySettingChange: function handleDisplaySettingChange( displaySettings ) {
 			this.get( 'selectedDisplaySettings' ).set( displaySettings.attributes );
@@ -71,7 +71,7 @@
 		 * settings.
 		 *
 		 * @param {Backbone.Model} model - Display settings model.
-		 * @returns {Backbone.Model} Display settings model.
+		 * @return {Backbone.Model} Display settings model.
 		 */
 		display: function getDisplaySettingsModel( model ) {
 			var display, selectedDisplaySettings = this.get( 'selectedDisplaySettings' );
@@ -100,8 +100,8 @@
 		 *
 		 * @since 4.9.0
 		 *
-		 * @param {object} options - Options.
-		 * @returns {void}
+		 * @param {Object} options - Options.
+		 * @return {void}
 		 */
 		initialize: function( options ) {
 			var view = this, embedController; // eslint-disable-line consistent-this
@@ -117,7 +117,7 @@
 		 *
 		 * Forked override of {wp.media.view.Embed#refresh()} to suppress irrelevant "link text" field.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		refresh: function refresh() {
 			/**
@@ -136,7 +136,7 @@
 					 * Set the disabled state on the Add to Widget button.
 					 *
 					 * @param {boolean} disabled - Disabled.
-					 * @returns {void}
+					 * @return {void}
 					 */
 					setAddToWidgetButtonDisabled: function setAddToWidgetButtonDisabled( disabled ) {
 						this.views.parent.views.parent.views.get( '.media-frame-toolbar' )[0].$el.find( '.media-button-select' ).prop( 'disabled', disabled );
@@ -146,7 +146,7 @@
 					 * Set or clear an error notice.
 					 *
 					 * @param {string} notice - Notice.
-					 * @returns {void}
+					 * @return {void}
 					 */
 					setErrorNotice: function setErrorNotice( notice ) {
 						var embedLinkView = this, noticeContainer; // eslint-disable-line consistent-this
@@ -175,7 +175,7 @@
 					 *
 					 * @since 4.9.0
 					 *
-					 * @returns {void}
+					 * @return {void}
 					 */
 					updateoEmbed: function() {
 						var embedLinkView = this, url; // eslint-disable-line consistent-this
@@ -200,7 +200,7 @@
 					/**
 					 * Fetch media.
 					 *
-					 * @returns {void}
+					 * @return {void}
 					 */
 					fetch: function() {
 						var embedLinkView = this, fetchSuccess, matches, fileExt, urlParser, url, re, youTubeEmbedMatch; // eslint-disable-line consistent-this
@@ -276,7 +276,7 @@
 					 * The element is getting display:none in the stylesheet, but the underlying method uses
 					 * uses {jQuery.fn.show()} which adds an inline style. This avoids the need for !important.
 					 *
-					 * @returns {void}
+					 * @return {void}
 					 */
 					renderFail: function renderFail() {
 						var embedLinkView = this; // eslint-disable-line consistent-this
@@ -306,7 +306,7 @@
 		/**
 		 * Create the default states.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		createStates: function createStates() {
 			var mime = this.options.mimeType, specificMimes = [];
@@ -358,7 +358,7 @@
 		 *
 		 * @param {wp.Backbone.View} view - Toolbar view.
 		 * @this {wp.media.controller.Library}
-		 * @returns {void}
+		 * @return {void}
 		 */
 		mainInsertToolbar: function mainInsertToolbar( view ) {
 			var controller = this; // eslint-disable-line consistent-this
@@ -374,7 +374,7 @@
 				 * @ignore
 				 *
 				 * @fires wp.media.controller.State#insert()
-				 * @returns {void}
+				 * @return {void}
 				 */
 				click: function onClick() {
 					var state = controller.state(),
@@ -393,7 +393,7 @@
 		 *
 		 * @param {wp.Backbone.View} toolbar - Toolbar view.
 		 * @this {wp.media.controller.Library}
-		 * @returns {void}
+		 * @return {void}
 		 */
 		mainEmbedToolbar: function mainEmbedToolbar( toolbar ) {
 			toolbar.view = new wp.media.view.Toolbar.Embed({
@@ -408,7 +408,7 @@
 		 *
 		 * Forked override of {wp.media.view.MediaFrame.Post#embedContent()} to suppress irrelevant "link text" field.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		embedContent: function embedContent() {
 			var view = new component.MediaEmbedView({
@@ -417,10 +417,6 @@
 			}).render();
 
 			this.content.set( view );
-
-			if ( ! wp.media.isTouchDevice ) {
-				view.url.focus();
-			}
 		}
 	});
 
@@ -493,7 +489,7 @@
 		 * @param {jQuery}         options.el - Control field container element.
 		 * @param {jQuery}         options.syncContainer - Container element where fields are synced for the server.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		initialize: function initialize( options ) {
 			var control = this;
@@ -597,7 +593,7 @@
 		/**
 		 * Update the selected attachment if necessary.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		updateSelectedAttachment: function updateSelectedAttachment() {
 			var control = this, attachment;
@@ -623,7 +619,7 @@
 		/**
 		 * Sync the model attributes to the hidden inputs, and update previewTemplateProps.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		syncModelToPreviewProps: function syncModelToPreviewProps() {
 			var control = this;
@@ -633,7 +629,7 @@
 		/**
 		 * Sync the model attributes to the hidden inputs, and update previewTemplateProps.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		syncModelToInputs: function syncModelToInputs() {
 			var control = this;
@@ -663,7 +659,7 @@
 		/**
 		 * Get template.
 		 *
-		 * @returns {Function} Template.
+		 * @return {Function} Template.
 		 */
 		template: function template() {
 			var control = this;
@@ -676,7 +672,7 @@
 		/**
 		 * Render template.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		render: function render() {
 			var control = this, titleInput;
@@ -699,7 +695,7 @@
 		 * Render media preview.
 		 *
 		 * @abstract
-		 * @returns {void}
+		 * @return {void}
 		 */
 		renderPreview: function renderPreview() {
 			throw new Error( 'renderPreview must be implemented' );
@@ -708,7 +704,7 @@
 		/**
 		 * Whether a media item is selected.
 		 *
-		 * @returns {boolean} Whether selected and no error.
+		 * @return {boolean} Whether selected and no error.
 		 */
 		isSelected: function isSelected() {
 			var control = this;
@@ -724,7 +720,7 @@
 		 * Handle click on link to Media Library to open modal, such as the link that appears when in the missing attachment error notice.
 		 *
 		 * @param {jQuery.Event} event - Event.
-		 * @returns {void}
+		 * @return {void}
 		 */
 		handleMediaLibraryLinkClick: function handleMediaLibraryLinkClick( event ) {
 			var control = this;
@@ -735,7 +731,7 @@
 		/**
 		 * Open the media select frame to chose an item.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		selectMedia: function selectMedia() {
 			var control = this, selection, mediaFrame, defaultSync, mediaFrameProps, selectionModels = [];
@@ -822,7 +818,7 @@
 		 * Get the instance props from the media selection frame.
 		 *
 		 * @param {wp.media.view.MediaFrame.Select} mediaFrame - Select frame.
-		 * @returns {Object} Props.
+		 * @return {Object} Props.
 		 */
 		getModelPropsFromMediaFrame: function getModelPropsFromMediaFrame( mediaFrame ) {
 			var control = this, state, mediaFrameProps, modelProps;
@@ -871,7 +867,7 @@
 		 * Map media frame props to model props.
 		 *
 		 * @param {Object} mediaFrameProps - Media frame props.
-		 * @returns {Object} Model props.
+		 * @return {Object} Model props.
 		 */
 		mapMediaToModelProps: function mapMediaToModelProps( mediaFrameProps ) {
 			var control = this, mediaFramePropToModelPropMap = {}, modelProps = {}, extension;
@@ -922,7 +918,7 @@
 		 * Map model props to media frame props.
 		 *
 		 * @param {Object} modelProps - Model props.
-		 * @returns {Object} Media frame props.
+		 * @return {Object} Media frame props.
 		 */
 		mapModelToMediaFrameProps: function mapModelToMediaFrameProps( modelProps ) {
 			var control = this, mediaFrameProps = {};
@@ -946,7 +942,7 @@
 		/**
 		 * Map model props to previewTemplateProps.
 		 *
-		 * @returns {Object} Preview Template Props.
+		 * @return {Object} Preview Template Props.
 		 */
 		mapModelToPreviewTemplateProps: function mapModelToPreviewTemplateProps() {
 			var control = this, previewTemplateProps = {};
@@ -965,7 +961,7 @@
 		 * Open the media frame to modify the selected item.
 		 *
 		 * @abstract
-		 * @returns {void}
+		 * @return {void}
 		 */
 		editMedia: function editMedia() {
 			throw new Error( 'editMedia not implemented' );
@@ -1013,7 +1009,7 @@
 		/**
 		 * Get default attribute values.
 		 *
-		 * @returns {Object} Mapping of property names to their default values.
+		 * @return {Object} Mapping of property names to their default values.
 		 */
 		defaults: function() {
 			var defaults = {};
@@ -1033,7 +1029,7 @@
 		 * @param {string|Object} key - Attribute name or attribute pairs.
 		 * @param {mixed|Object}  [val] - Attribute value or options object.
 		 * @param {Object}        [options] - Options when attribute name and value are passed separately.
-		 * @returns {wp.mediaWidgets.MediaWidgetModel} This model.
+		 * @return {wp.mediaWidgets.MediaWidgetModel} This model.
 		 */
 		set: function set( key, val, options ) {
 			var model = this, attrs, opts, castedAttrs; // eslint-disable-line consistent-this
@@ -1087,7 +1083,7 @@
 		/**
 		 * Get props which are merged on top of the model when an embed is chosen (as opposed to an attachment).
 		 *
-		 * @returns {Object} Reset/override props.
+		 * @return {Object} Reset/override props.
 		 */
 		getEmbedResetProps: function getEmbedResetProps() {
 			return {
@@ -1124,7 +1120,7 @@
 	 * @param {jQuery.Event} event - Event.
 	 * @param {jQuery}       widgetContainer - Widget container element.
 	 *
-	 * @returns {void}
+	 * @return {void}
 	 */
 	component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
 		var fieldContainer, syncContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId, animatedCheckDelay = 50, renderWhenAnimationDone;
@@ -1207,7 +1203,7 @@
 	 *
 	 * @memberOf wp.mediaWidgets
 	 *
-	 * @returns {void}
+	 * @return {void}
 	 */
 	component.setupAccessibleMode = function setupAccessibleMode() {
 		var widgetForm, widgetId, idBase, widgetControl, ControlConstructor, ModelConstructor, modelAttributes, fieldContainer, syncContainer;
@@ -1261,7 +1257,7 @@
 	 * @param {jQuery.Event} event - Event.
 	 * @param {jQuery}       widgetContainer - Widget container element.
 	 *
-	 * @returns {void}
+	 * @return {void}
 	 */
 	component.handleWidgetUpdated = function handleWidgetUpdated( event, widgetContainer ) {
 		var widgetForm, widgetContent, widgetId, widgetControl, attributes = {};
@@ -1295,7 +1291,7 @@
 	 *
 	 * @memberOf wp.mediaWidgets
 	 *
-	 * @returns {void}
+	 * @return {void}
 	 */
 	component.init = function init() {
 		var $document = $( document );