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:
parent
fa5ec5077b
commit
82a26045e5
|
@ -313,8 +313,9 @@ commentReply = {
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle : function(el) {
|
toggle : function(el) {
|
||||||
if ( $(el).css('display') != 'none' )
|
if ( 'none' !== $( el ).css( 'display' ) && ( $( '#replyrow' ).parent().is('#com-reply') || window.confirm( adminCommentsL10n.warnQuickEdit ) ) ) {
|
||||||
$(el).find('a.vim-q').click();
|
$( el ).find( 'a.vim-q' ).click();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
revert : function() {
|
revert : function() {
|
||||||
|
|
|
@ -439,7 +439,8 @@ function wp_default_scripts( &$scripts ) {
|
||||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||||
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
|
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
|
||||||
'replyApprove' => __( 'Approve and Reply' ),
|
'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 );
|
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );
|
||||||
|
|
Loading…
Reference in New Issue