Make WordPress Core

Ticket #41545: 41545.5.diff

File 41545.5.diff, 786 bytes (added by splitti, 3 years ago)

Updated patch to enable CMD+enter as well

  • src/js/_enqueues/lib/comment-reply.js

    diff --git a/src/js/_enqueues/lib/comment-reply.js b/src/js/_enqueues/lib/comment-reply.js
    index 75fc183e42..725008c655 100644
    a b window.addComment = ( function( window ) { 
    9595                cancelElement.addEventListener( 'touchstart', cancelEvent );
    9696                cancelElement.addEventListener( 'click',      cancelEvent );
    9797
     98                commentFormElement.querySelector( 'textarea#comment' ).addEventListener( 'keydown', function( e ) {
     99                        if ( ( e.metaKey || e.ctrlKey ) && e.keyCode === 13 ) {
     100                                // The submit button ID is 'submit' so we can't call commentFormElement.submit(). Click it instead.
     101                                commentFormElement.submit.click();
     102                        }
     103                });
     104
    98105                var links = replyLinks( context );
    99106                var element;
    100107