wp/wp-admin/js/inline-edit-post.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-admin/js/inline-edit-post.js	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-admin/js/inline-edit-post.js	Mon Oct 14 18:28:13 2019 +0200
@@ -1,19 +1,20 @@
-/* global inlineEditL10n, ajaxurl, typenow */
 /**
  * This file contains the functions needed for the inline editing of posts.
  *
  * @since 2.7.0
+ * @output wp-admin/js/inline-edit-post.js
  */
 
+/* global inlineEditL10n, ajaxurl, typenow, inlineEditPost */
+
 window.wp = window.wp || {};
 
 /**
  * Manages the quick edit and bulk edit windows for editing posts or pages.
  *
- * @namespace
+ * @namespace inlineEditPost
  *
  * @since 2.7.0
- * @access public
  *
  * @type {Object}
  *
@@ -21,13 +22,12 @@
  * @property {string} what The prefix before the post id.
  *
  */
-var inlineEditPost;
 ( function( $, wp ) {
 
-	inlineEditPost = {
+	window.inlineEditPost = {
 
 	/**
-	 * @summary Initializes the inline and bulk post editor.
+	 * Initializes the inline and bulk post editor.
 	 *
 	 * Binds event handlers to the escape key to close the inline editor
 	 * and to the save and close buttons. Changes DOM to be ready for inline
@@ -46,7 +46,7 @@
 		t.what = '#post-';
 
 		/**
-		 * @summary Bind escape key to revert the changes and close the quick editor.
+		 * Binds the escape key to revert the changes and close the quick editor.
 		 *
 		 * @returns {boolean} The result of revert.
 		 */
@@ -58,7 +58,7 @@
 		});
 
 		/**
-		 * @summary Bind escape key to revert the changes and close the bulk editor.
+		 * Binds the escape key to revert the changes and close the bulk editor.
 		 *
 		 * @returns {boolean} The result of revert.
 		 */
@@ -70,7 +70,7 @@
 		});
 
 		/**
-		 * @summary Revert changes and close the quick editor if the cancel button is clicked.
+		 * Reverts changes and close the quick editor if the cancel button is clicked.
 		 *
 		 * @returns {boolean} The result of revert.
 		 */
@@ -79,7 +79,7 @@
 		});
 
 		/**
-		 * @summary Save changes in the quick editor if the save(named: update) button is clicked.
+		 * Saves changes in the quick editor if the save(named: update) button is clicked.
 		 *
 		 * @returns {boolean} The result of save.
 		 */
@@ -88,7 +88,7 @@
 		});
 
 		/**
-		 * @summary If enter is pressed, and the target is not the cancel button, save the post.
+		 * If enter is pressed, and the target is not the cancel button, save the post.
 		 *
 		 * @returns {boolean} The result of save.
 		 */
@@ -99,7 +99,7 @@
 		});
 
 		/**
-		 * @summary Revert changes and close the bulk editor if the cancel button is clicked.
+		 * Reverts changes and close the bulk editor if the cancel button is clicked.
 		 *
 		 * @returns {boolean} The result of revert.
 		 */
@@ -108,7 +108,7 @@
 		});
 
 		/**
-		 * @summary Disables the password input field when the private post checkbox is checked.
+		 * Disables the password input field when the private post checkbox is checked.
 		 */
 		$('#inline-edit .inline-edit-private input[value="private"]').click( function(){
 			var pw = $('input.inline-edit-password-input');
@@ -120,11 +120,11 @@
 		});
 
 		/**
-		 * @summary Bind click event to the .editinline link which opens the quick editor.
+		 * Binds click event to the .editinline button which opens the quick editor.
 		 */
-		$('#the-list').on( 'click', 'a.editinline', function( e ) {
-			e.preventDefault();
-			inlineEditPost.edit(this);
+		$( '#the-list' ).on( 'click', '.editinline', function() {
+			$( this ).attr( 'aria-expanded', 'true' );
+			inlineEditPost.edit( this );
 		});
 
 		$('#bulk-edit').find('fieldset:first').after(
@@ -136,7 +136,7 @@
 		$('select[name="_status"] option[value="future"]', bulkRow).remove();
 
 		/**
-		 * @summary Adds onclick events to the apply buttons.
+		 * Adds onclick events to the apply buttons.
 		 */
 		$('#doaction, #doaction2').click(function(e){
 			var n;
@@ -154,9 +154,8 @@
 	},
 
 	/**
-	 * @summary Toggles the quick edit window.
-	 *
-	 * Hides the window when it's active and shows the window when inactive.
+	 * Toggles the quick edit window, hiding it when it's active and showing it when
+	 * inactive.
 	 *
 	 * @memberof inlineEditPost
 	 * @since 2.7.0
@@ -169,7 +168,7 @@
 	},
 
 	/**
-	 * @summary Creates the bulk editor row to edit multiple posts at once.
+	 * Creates the bulk editor row to edit multiple posts at once.
 	 *
 	 * @memberof inlineEditPost
 	 * @since 2.7.0
@@ -185,10 +184,10 @@
 		$('#bulk-edit').addClass('inline-editor').show();
 
 		/**
-		 * @summary Create a HTML div with the title and a delete link(cross-icon) for each selected post.
+		 * Create a HTML div with the title and a link(delete-icon) for each selected
+		 * post.
 		 *
 		 * Get the selected posts based on the checked checkboxes in the post table.
-		 * Create a HTML div with the title and a link(delete-icon) for each selected post.
 		 */
 		$( 'tbody th.check-column input[type="checkbox"]' ).each( function() {
 
@@ -209,7 +208,7 @@
 		// Add onclick events to the delete-icons in the bulk editors the post title list.
 		$('#bulk-titles').html(te);
 		/**
-		 * @summary Binds on click events to the checkboxes before the posts in the table.
+		 * Binds on click events to the checkboxes before the posts in the table.
 		 *
 		 * @listens click
 		 */
@@ -241,7 +240,7 @@
 	},
 
 	/**
-	 * @summary Creates a quick edit window for the post that has been clicked.
+	 * Creates a quick edit window for the post that has been clicked.
 	 *
 	 * @memberof inlineEditPost
 	 * @since 2.7.0
@@ -284,7 +283,7 @@
 			val = $('.'+fields[f], rowData);
 
 			/**
-			 * @summary Replaces the image for a Twemoji(Twitter emoji) with it's alternate text.
+			 * Replaces the image for a Twemoji(Twitter emoji) with it's alternate text.
 			 *
 			 * @returns Alternate text from the image.
 			 */
@@ -304,7 +303,7 @@
 		}
 
 		/**
-		 * @summary Creates the select boxes for the categories.
+		 * Creates the select boxes for the categories.
 		 */
 		$('.post_category', rowData).each(function(){
 			var taxname,
@@ -317,8 +316,8 @@
 		});
 
 		/**
-		 * @summary Gets all the taxonomies for live auto-fill suggestions.
-		 * When typing the name of a tag.
+		 * Gets all the taxonomies for live auto-fill suggestions when typing the name
+		 * of a tag.
 		 */
 		$('.tags_input', rowData).each(function(){
 			var terms = $(this),
@@ -381,7 +380,7 @@
 	},
 
 	/**
-	 * @summary Saves the changes made in the quick edit window to the post.
+	 * Saves the changes made in the quick edit window to the post.
 	 * AJAX saving is only for Quick Edit and not for bulk edit.
 	 *
 	 * @since 2.7.0
@@ -424,8 +423,10 @@
 						$(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove();
 						$('#edit-'+id).before(r).remove();
 						$( inlineEditPost.what + id ).hide().fadeIn( 400, function() {
-							// Move focus back to the Quick Edit link. $( this ) is the row being animated.
-							$( this ).find( '.editinline' ).focus();
+							// Move focus back to the Quick Edit button. $( this ) is the row being animated.
+							$( this ).find( '.editinline' )
+								.attr( 'aria-expanded', 'false' )
+								.focus();
 							wp.a11y.speak( inlineEditL10n.saved );
 						});
 					} else {
@@ -447,7 +448,7 @@
 	},
 
 	/**
-	 * @summary Hides and empties the Quick Edit and/or Bulk Edit windows.
+	 * Hides and empties the Quick Edit and/or Bulk Edit windows.
 	 *
 	 * @memberof    inlineEditPost
 	 * @since 2.7.0
@@ -479,8 +480,10 @@
 				$('#'+id).siblings('tr.hidden').addBack().remove();
 				id = id.substr( id.lastIndexOf('-') + 1 );
 
-				// Show the post row and move focus back to the Quick Edit link.
-				$( this.what + id ).show().find( '.editinline' ).focus();
+				// Show the post row and move focus back to the Quick Edit button.
+				$( this.what + id ).show().find( '.editinline' )
+					.attr( 'aria-expanded', 'false' )
+					.focus();
 			}
 		}
 
@@ -488,8 +491,8 @@
 	},
 
 	/**
-	 * @summary Gets the id for a the post that you want to quick edit from the row
-	 * in the quick edit table.
+	 * Gets the id for a the post that you want to quick edit from the row in the quick
+	 * edit table.
 	 *
 	 * @memberof    inlineEditPost
 	 * @since 2.7.0