mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-10 18:37:58 +01:00
Comments: Simplify JS for inline edit and reply.
fixes #27533. Built from https://develop.svn.wordpress.org/trunk@29662 git-svn-id: http://core.svn.wordpress.org/trunk@29436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3cdc7b1679
commit
b80c5d3e51
@ -474,11 +474,11 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
|
||||
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
|
||||
|
||||
$format = '<a data-comment-id="%d" data-post-id="%d" class="%s" title="%s" href="#">%s</a>';
|
||||
$format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
|
||||
|
||||
$actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-q edit-comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
|
||||
$actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
|
||||
|
||||
$actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-r reply-comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
|
||||
$actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/dashboard.php */
|
||||
|
@ -608,24 +608,18 @@ $(document).ready(function(){
|
||||
);
|
||||
}
|
||||
|
||||
if ( typeof commentReply != 'undefined' ) {
|
||||
// Quick Edit and Reply have an inline comment editor.
|
||||
$( '#the-comment-list' ).on( 'click', '.comment-inline', function (e) {
|
||||
e.preventDefault();
|
||||
var $el = $( this ),
|
||||
action = 'replyto';
|
||||
|
||||
// Each "Quick Edit" link, open the comment editor
|
||||
$( 'body' ).on( 'click', '.comment .row-actions .quickedit .edit-comment-inline', function (e) {
|
||||
e.preventDefault();
|
||||
if ( 'undefined' !== typeof $el.data( 'action' ) ) {
|
||||
action = $el.data( 'action' );
|
||||
}
|
||||
|
||||
var $el = $( e.currentTarget );
|
||||
commentReply.open( $el.data( 'comment-id' ), $el.data( 'post-id' ), 'edit' );
|
||||
} );
|
||||
|
||||
// Each "Reply" link, open the comment reply
|
||||
$( 'body' ).on( 'click', '.comment .row-actions .reply .reply-comment-inline', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $el = $( e.currentTarget );
|
||||
commentReply.open( $el.data('comment-id'), $el.data('post-id') );
|
||||
} );
|
||||
}
|
||||
commentReply.open( $el.data( 'commentId' ), $el.data( 'postId' ), action );
|
||||
} );
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
2
wp-admin/js/edit-comments.min.js
vendored
2
wp-admin/js/edit-comments.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user