--- a/wp/wp-admin/js/inline-edit-post.js Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/js/inline-edit-post.js Wed Sep 21 18:19:35 2022 +0200
@@ -51,7 +51,7 @@
*
* @return {boolean} The result of revert.
*/
- qeRow.keyup(function(e){
+ qeRow.on( 'keyup', function(e){
// Revert changes if Escape key is pressed.
if ( e.which === 27 ) {
return inlineEditPost.revert();
@@ -63,7 +63,7 @@
*
* @return {boolean} The result of revert.
*/
- bulkRow.keyup(function(e){
+ bulkRow.on( 'keyup', function(e){
// Revert changes if Escape key is pressed.
if ( e.which === 27 ) {
return inlineEditPost.revert();
@@ -75,7 +75,7 @@
*
* @return {boolean} The result of revert.
*/
- $( '.cancel', qeRow ).click( function() {
+ $( '.cancel', qeRow ).on( 'click', function() {
return inlineEditPost.revert();
});
@@ -84,7 +84,7 @@
*
* @return {boolean} The result of save.
*/
- $( '.save', qeRow ).click( function() {
+ $( '.save', qeRow ).on( 'click', function() {
return inlineEditPost.save(this);
});
@@ -93,7 +93,7 @@
*
* @return {boolean} The result of save.
*/
- $('td', qeRow).keydown(function(e){
+ $('td', qeRow).on( 'keydown', function(e){
if ( e.which === 13 && ! $( e.target ).hasClass( 'cancel' ) ) {
return inlineEditPost.save(this);
}
@@ -104,14 +104,14 @@
*
* @return {boolean} The result of revert.
*/
- $( '.cancel', bulkRow ).click( function() {
+ $( '.cancel', bulkRow ).on( 'click', function() {
return inlineEditPost.revert();
});
/**
* Disables the password input field when the private post checkbox is checked.
*/
- $('#inline-edit .inline-edit-private input[value="private"]').click( function(){
+ $('#inline-edit .inline-edit-private input[value="private"]').on( 'click', function(){
var pw = $('input.inline-edit-password-input');
if ( $(this).prop('checked') ) {
pw.val('').prop('disabled', true);
@@ -139,7 +139,7 @@
/**
* Adds onclick events to the apply buttons.
*/
- $('#doaction, #doaction2').click(function(e){
+ $('#doaction').on( 'click', function(e){
var n;
t.whichBulkButtonId = $( this ).attr( 'id' );
@@ -215,7 +215,7 @@
*
* @listens click
*/
- $('#bulk-titles a').click(function(){
+ $('#bulk-titles a').on( 'click', function(){
var id = $(this).attr('id').substr(1);
$('table.widefat input[value="' + id + '"]').prop('checked', false);
@@ -329,6 +329,11 @@
textarea = $('textarea.tax_input_' + taxname, editRow),
comma = wp.i18n._x( ',', 'tag delimiter' ).trim();
+ // Ensure the textarea exists.
+ if ( ! textarea.length ) {
+ return;
+ }
+
terms.find( 'img' ).replaceWith( function() { return this.alt; } );
terms = terms.text();
@@ -378,7 +383,7 @@
}
$(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show();
- $('.ptitle', editRow).focus();
+ $('.ptitle', editRow).trigger( 'focus' );
return false;
},
@@ -420,7 +425,6 @@
$error = $errorNotice.find( '.error' );
$( 'table.widefat .spinner' ).removeClass( 'is-active' );
- $( '.ac_results' ).hide();
if (r) {
if ( -1 !== r.indexOf( '<tr' ) ) {
@@ -430,7 +434,7 @@
// Move focus back to the Quick Edit button. $( this ) is the row being animated.
$( this ).find( '.editinline' )
.attr( 'aria-expanded', 'false' )
- .focus();
+ .trigger( 'focus' );
wp.a11y.speak( wp.i18n.__( 'Changes saved.' ) );
});
} else {
@@ -466,7 +470,6 @@
if ( id ) {
$( '.spinner', $tableWideFat ).removeClass( 'is-active' );
- $( '.ac_results' ).hide();
if ( 'bulk-edit' === id ) {
@@ -478,7 +481,7 @@
$('#inlineedit').append( $('#bulk-edit') );
// Move focus back to the Bulk Action button that was activated.
- $( '#' + inlineEditPost.whichBulkButtonId ).focus();
+ $( '#' + inlineEditPost.whichBulkButtonId ).trigger( 'focus' );
} else {
// Remove both the inline-editor and its hidden tr siblings.
@@ -488,7 +491,7 @@
// Show the post row and move focus back to the Quick Edit button.
$( this.what + id ).show().find( '.editinline' )
.attr( 'aria-expanded', 'false' )
- .focus();
+ .trigger( 'focus' );
}
}
@@ -513,10 +516,16 @@
}
};
-$( document ).ready( function(){ inlineEditPost.init(); } );
+$( function() { inlineEditPost.init(); } );
// Show/hide locks on posts.
-$( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
+$( function() {
+
+ // Set the heartbeat interval to 15 seconds.
+ if ( typeof wp !== 'undefined' && wp.heartbeat ) {
+ wp.heartbeat.interval( 15 );
+ }
+}).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
var locked = data['wp-check-locked-posts'] || {};
$('#the-list tr').each( function(i, el) {
@@ -557,12 +566,6 @@
if ( check.length ) {
data['wp-check-locked-posts'] = check;
}
-}).ready( function() {
-
- // Set the heartbeat interval to 15 seconds.
- if ( typeof wp !== 'undefined' && wp.heartbeat ) {
- wp.heartbeat.interval( 15 );
- }
});
})( jQuery, window.wp );