WordPress.org

Make WordPress Core

Ticket #41545: 41545.2.diff

File 41545.2.diff, 2.6 KB (added by Lindstromer, 2 years ago)

PHPStorm bugged with code style messing up files in previous diff. Also added html-file that was missed.

  • src/wp-admin/js/edit-comments.js

    diff --git a/src/wp-admin/js/edit-comments.js b/src/wp-admin/js/edit-comments.js
    index 9e0fc09602..16a1b405c8 100644
    a b commentReply = { 
    580580
    581581                $('a.cancel', row).click(function() { return commentReply.revert(); });
    582582                $('a.save', row).click(function() { return commentReply.send(); });
     583
     584                // Allow users to use Ctrl/Cmd+Enter to submit comment
     585                $('#replycontent', editRow).keydown(function (e) {
     586                        if (( e.metaKey || e.ctrlKey ) && e.keyCode == 13) {
     587                                commentReply.send();
     588                                e.preventDefault();
     589                                return false;
     590                        }
     591                });
     592
    583593                $( 'input#author-name, input#author-email, input#author-url', row ).keypress( function( e ) {
    584594                        if ( e.which == 13 ) {
    585595                                commentReply.send();
  • src/wp-includes/comment-template.php

    diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
    index b9b4cae49d..c531dd2be6 100644
    a b function comment_form( $args = array(), $post_id = null ) { 
    22152215        $fields = apply_filters( 'comment_form_default_fields', $fields );
    22162216        $defaults = array(
    22172217                'fields'               => $fields,
    2218                 'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>',
     2218                'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required" onkeydown="return addComment.submitForm( event, \'comment\' )"></textarea></p>',
    22192219                /** This filter is documented in wp-includes/link-template.php */
    22202220                'must_log_in'          => '<p class="must-log-in">' . sprintf(
    22212221                                              /* translators: %s: login URL */
  • src/wp-includes/js/comment-reply.js

    diff --git a/src/wp-includes/js/comment-reply.js b/src/wp-includes/js/comment-reply.js
    index 184726d35e..73872a2d32 100644
    a b  
    11var addComment = {
     2        submitForm: function( e, textareaId ) {
     3                if ( ( e.metaKey || e.ctrlKey ) && e.keyCode == 13 ) {
     4                        var t           = this,
     5                                textarea    = t.I( textareaId ),
     6                                commentForm = t.I( textarea.form.id );
     7
     8                        document.createElement( 'form' ).submit.call( commentForm );
     9                        e.preventDefault();
     10                        return false;
     11                }
     12        },
     13
    214        moveForm: function( commId, parentId, respondId, postId ) {
    315                var div, element, style, cssHidden,
    416                        t           = this,