Ticket #32818: 32818.diff
File 32818.diff, 2.7 KB (added by , 10 years ago) |
---|
-
src/wp-includes/script-loader.php
474 474 'replyApprove' => __( 'Approve and Reply' ), 475 475 'reply' => __( 'Reply' ), 476 476 'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ), 477 'warnDiscardChanges' => __( "Are you sure you want to do this?\nThe reply changes you made will be lost." ), 477 478 ) ); 478 479 479 480 $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 ); -
src/wp-admin/js/edit-comments.js
495 495 commentReply = { 496 496 cid : '', 497 497 act : '', 498 originalContent : '', 498 499 499 500 init : function() { 500 501 var row = $('#replyrow'); … … 578 579 $( '.spinner', replyrow ).removeClass( 'is-active' ); 579 580 580 581 this.cid = ''; 582 this.originalContent = ''; 581 583 }, 582 584 583 585 open : function(comment_id, post_id, action) { … … 586 588 c = $('#comment-' + comment_id), 587 589 h = c.height(); 588 590 591 if ( ! this.discardChanges() ) { 592 // Ask the user to preserve any edits to already open comments 593 return false; 594 } 595 589 596 t.close(); 590 597 t.cid = comment_id; 591 598 … … 594 601 action = action || 'replyto'; 595 602 act = 'edit' == action ? 'edit' : 'replyto'; 596 603 act = t.act = act + '-comment'; 604 t.originalContent = $('textarea.comment', rowData).val(); 597 605 598 606 $('#action', editRow).val(act); 599 607 $('#comment_post_ID', editRow).val(post_id); … … 766 774 $('table.comments-box').css('display', ''); 767 775 $('#no-comments').remove(); 768 776 }); 777 }, 778 779 /** 780 * If an open reply has been changed, warn the user they will lose changes 781 * and act on the response. 782 * 783 * @returns {boolean} 784 */ 785 discardChanges: function() { 786 var editRow = $( '#replyrow' ); 787 788 if ( this.originalContent === $( '#replycontent', editRow ).val() ) { 789 return true; 790 } 791 792 return window.confirm( adminCommentsL10n.warnDiscardChanges ); 769 793 } 770 794 }; 771 795 -
src/wp-admin/js/post.js
268 268 269 269 if ( typeof commentReply !== 'undefined' ) { 270 270 /* 271 * Don't submit the edit post if a comment reply has been edited 272 * and the user wants to preserve it. 273 */ 274 if ( ! commentReply.discardChanges() ) { 275 return false; 276 } 277 278 /* 271 279 * Close the comment edit/reply form if open to stop the form 272 280 * action from interfering with the post's form action. 273 281 */