Check that current changes can be lost before editing another comment.

When replying to or editing a comment, double-clicking another comment will
open it in quick edit and changes to the current comment are lost.

Props pareshradadiya, chriscct7.
Fixes #21845.



git-svn-id: https://develop.svn.wordpress.org/trunk@32857 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland 2015-06-19 13:47:35 +00:00
parent fa5ec5077b
commit 82a26045e5
2 changed files with 5 additions and 3 deletions

View File

@ -313,8 +313,9 @@ commentReply = {
},
toggle : function(el) {
if ( $(el).css('display') != 'none' )
$(el).find('a.vim-q').click();
if ( 'none' !== $( el ).css( 'display' ) && ( $( '#replyrow' ).parent().is('#com-reply') || window.confirm( adminCommentsL10n.warnQuickEdit ) ) ) {
$( el ).find( 'a.vim-q' ).click();
}
},
revert : function() {

View File

@ -439,7 +439,8 @@ function wp_default_scripts( &$scripts ) {
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
'replyApprove' => __( 'Approve and Reply' ),
'reply' => __( 'Reply' )
'reply' => __( 'Reply' ),
'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
) );
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );