From 42a2df9d251d8064bf8e45408078a6b2c27ea415 Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Wed, 17 May 2017 10:47:08 +0200 Subject: [PATCH] Submit comment with ctrl+enter or cmd+enter --- app/assets/javascripts/application.js.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 2d77117..f017dc0 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -512,4 +512,11 @@ $(document).ready(function() { $("#story_guidelines").toggle(); return false; }); + + + $('textarea#comment').keydown(function (e) { + if ((e.metaKey || e.ctrlKey) && e.keyCode == 13) { + $("button.comment-post").click(); + } + }); });