Comments: Prevent AYS prompt when replying to a comment and nothing has been entered.

When replying to a comment and nothing has yet been entered for the reply content, clicking "Reply" or "Quick Edit" on another comment presents the "Are you sure..." prompt indicating there are unsaved changes in the reply content.  However, if nothing is entered, this prompt should not be displayed.

This change implements a new check to determine if any text has been entered by the user before deciding to show the "Are you sure..." prompt.

Props cu121, mkox, azouamauriac, hasanuzzamanshamim, pls78, faisal03, rafiahmedd.
Fixes #54990.
Built from https://develop.svn.wordpress.org/trunk@54334


git-svn-id: http://core.svn.wordpress.org/trunk@53893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
davidbaumwald 2022-09-27 17:06:09 +00:00
parent bed72ed20d
commit fe346c1464
3 changed files with 3 additions and 3 deletions

View File

@ -1225,7 +1225,7 @@ window.commentReply = {
discardCommentChanges: function() {
var editRow = $( '#replyrow' );
if ( this.originalContent === $( '#replycontent', editRow ).val() ) {
if ( '' === $( '#replycontent', editRow ).val() || this.originalContent === $( '#replycontent', editRow ).val() ) {
return true;
}

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-beta1-54333';
$wp_version = '6.1-beta1-54334';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.