Make WordPress Core

Ticket #30979: 30979.2.diff

File 30979.2.diff, 966 bytes (added by tyxla, 10 years ago)

Refreshing the patch to use on() instead of bind(). Reason: as the jQuery documentation suggests, on() is the recommended method and should be used instead of bind(). For more information: http://api.jquery.com/bind/#entry-longdesc

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

     
    416416                }
    417417
    418418                setTimeout(function() {
    419                         var rtop, rbottom, scrollTop, vp, scrollBottom;
     419                        var rtop, rbottom, scrollTop, vp, scrollBottom, contextMenu = false;
    420420
    421421                        rtop = $('#replyrow').offset().top;
    422422                        rbottom = rtop + $('#replyrow').height();
     
    429429                        else if ( rtop - 20 < scrollTop )
    430430                                window.scroll(0, rtop - 35);
    431431
    432                         $('#replycontent').focus().keyup(function(e){
    433                                 if ( e.which == 27 )
     432                        $('#replycontent').focus().on('mousedown keyup', function(e){
     433                                if ( e.which == 27 && ! contextMenu ) {
    434434                                        commentReply.revert(); // close on Escape
     435                                }
     436
     437                                if ( e.button == 2 || e.which == 93 ) {
     438                                        contextMenu = true;
     439                                }
     440                                else {
     441                                        contextMenu = false;
     442                                }
    435443                        });
    436444                }, 600);
    437445