From ba4643f76e97ffcf16c31e0aed261803d13b2d48 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 3 Dec 2013 00:54:42 +0000 Subject: [PATCH] Comments moderation screen: - Don't resize the textarea when replying to long comments. - Limit the resizing of the textarea when quick-editing long comments to 500px. Props SergeyBiryukov, fixes #25746. git-svn-id: https://develop.svn.wordpress.org/trunk@26550 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/edit-comments.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/js/edit-comments.js b/src/wp-admin/js/edit-comments.js index 17de857664..97415012eb 100644 --- a/src/wp-admin/js/edit-comments.js +++ b/src/wp-admin/js/edit-comments.js @@ -382,7 +382,10 @@ commentReply = { }, open : function(comment_id, post_id, action) { - var t = this, editRow, rowData, act, c = $('#comment-' + comment_id), h = c.height(), replyButton; + var editRow, rowData, act, replyButton, editHeight, + t = this, + c = $('#comment-' + comment_id), + h = c.height(); t.close(); t.cid = comment_id; @@ -397,9 +400,6 @@ commentReply = { $('#comment_post_ID', editRow).val(post_id); $('#comment_ID', editRow).val(comment_id); - if ( h > 120 ) - $('#replycontent', editRow).css('height', (35+h) + 'px'); - if ( action == 'edit' ) { $('#author', editRow).val( $('div.author', rowData).text() ); $('#author-email', editRow).val( $('div.author-email', rowData).text() ); @@ -409,6 +409,13 @@ commentReply = { $('#edithead, #savebtn', editRow).show(); $('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide(); + if ( h > 120 ) { + // Limit the maximum height when editing very long comments to make it more manageable. + // The textarea is resizable in most browsers, so the user can adjust it if needed. + editHeight = h > 500 ? 500 : h; + $('#replycontent', editRow).css('height', editHeight + 'px'); + } + c.after( editRow ).fadeOut('fast', function(){ $('#replyrow').fadeIn(300, function(){ $(this).show(); }); });