IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
487 | 487 | 'replyApprove' => __( 'Approve and Reply' ), |
488 | 488 | 'reply' => __( 'Reply' ), |
489 | 489 | 'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ), |
| 490 | 'warnDiscardChanges' => __( "Are you sure you want to do this?\nThe reply changes you made will be lost." ), |
490 | 491 | 'docTitleComments' => __( 'Comments' ), |
491 | 492 | /* translators: %s: comments count */ |
492 | 493 | 'docTitleCommentsCount' => __( 'Comments (%s)' ), |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
272 | 272 | |
273 | 273 | if ( typeof commentReply !== 'undefined' ) { |
274 | 274 | /* |
| 275 | * Don't submit the edit post if a comment reply has been edited |
| 276 | * and the user wants to preserve it. |
| 277 | */ |
| 278 | if ( ! commentReply.discardChanges() ) { |
| 279 | return false; |
| 280 | } |
| 281 | |
| 282 | /* |
275 | 283 | * Close the comment edit/reply form if open to stop the form |
276 | 284 | * action from interfering with the post's form action. |
277 | 285 | */ |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
559 | 559 | commentReply = { |
560 | 560 | cid : '', |
561 | 561 | act : '', |
| 562 | originalContent : '', |
562 | 563 | |
563 | 564 | init : function() { |
564 | 565 | var row = $('#replyrow'); |
… |
… |
|
642 | 643 | $( '.spinner', replyrow ).removeClass( 'is-active' ); |
643 | 644 | |
644 | 645 | this.cid = ''; |
| 646 | this.originalContent = ''; |
645 | 647 | }, |
646 | 648 | |
647 | 649 | open : function(comment_id, post_id, action) { |
… |
… |
|
651 | 653 | h = c.height(), |
652 | 654 | colspanVal = 0; |
653 | 655 | |
| 656 | if ( ! this.discardChanges() ) { |
| 657 | // Ask the user to preserve any edits to already open comments |
| 658 | return false; |
| 659 | } |
| 660 | |
654 | 661 | t.close(); |
655 | 662 | t.cid = comment_id; |
656 | 663 | |
… |
… |
|
659 | 666 | action = action || 'replyto'; |
660 | 667 | act = 'edit' == action ? 'edit' : 'replyto'; |
661 | 668 | act = t.act = act + '-comment'; |
| 669 | t.originalContent = $('textarea.comment', rowData).val(); |
662 | 670 | colspanVal = $( '> th:visible, > td:visible', c ).length; |
663 | 671 | |
664 | 672 | // Make sure it's actually a table and there's a `colspan` value to apply. |
… |
… |
|
846 | 854 | $('table.comments-box').css('display', ''); |
847 | 855 | $('#no-comments').remove(); |
848 | 856 | }); |
| 857 | }, |
| 858 | |
| 859 | /** |
| 860 | * If an open reply has been changed, warn the user they will lose changes |
| 861 | * and act on the response. |
| 862 | * |
| 863 | * @returns {boolean} |
| 864 | */ |
| 865 | discardChanges: function() { |
| 866 | var editRow = $( '#replyrow' ); |
| 867 | |
| 868 | if ( this.originalContent === $( '#replycontent', editRow ).val() ) { |
| 869 | return true; |
| 870 | } |
| 871 | |
| 872 | return window.confirm( adminCommentsL10n.warnDiscardChanges ); |
849 | 873 | } |
850 | 874 | }; |
851 | 875 | |