#4538 issue and pull request comment boxes: ctrl-key submits the form
Merged a year ago by pingou. Opened 2 years ago by jlanda.
jlanda/pagure ctrl-enter-submit  into  master

@@ -1237,6 +1237,18 @@ 

      }

    );

  

+   function submitFormOnCtrlKey(event) {

+     if (event.ctrlKey && event.keyCode == 13) {

+       var form = event.target.form;

+       form.submit();

+       event.preventDefault();

+     }

+   }

+ 

+   $('#comment').keydown(function(e) {

+     submitFormOnCtrlKey(e);

+   });

+ 

  

    {% if g.authenticated and (

      g.repo_user

@@ -1016,6 +1016,21 @@ 

      return try_async_comment($(this), false);

    })

  

+   function submitFormOnCtrlKey(event) {

+     if (event.ctrlKey && event.keyCode == 13) {

+       var form = event.target.form;

+       form.submit();

+       event.preventDefault();

+     }

+   }

+ 

+   $('#comment').keydown(function(e) {

+     submitFormOnCtrlKey(e);

+   });

+   $('#inline-comment').keydown(function(e) {

+     submitFormOnCtrlKey(e);

+   });

+ 

  {% if pull_request %}

  {# These lines are only for existing pull-requests, not new ones #}