From 2e9e542bfb81c3aff407801e3ae3f08eee0fb3d9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 8 Jan 2018 18:51:49 +0100 Subject: cmd-s to save --- public/assets/js/lib/views/details/commentform.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'public/assets/js/lib/views/details/commentform.js') diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js index db08ef1..9a748f9 100644 --- a/public/assets/js/lib/views/details/commentform.js +++ b/public/assets/js/lib/views/details/commentform.js @@ -5,6 +5,7 @@ var CommentForm = FormView.extend({ events: { "focus textarea": 'focus', "mouseup input[type=file]": 'focus', + "keydown textarea": 'keydown', }, action: "", @@ -22,6 +23,14 @@ var CommentForm = FormView.extend({ } }, + keydown: function(e){ + if ((e.ctrlKey || e.metaKey || e.altKey) && e.keyCode == 83) { // "s" key + e.preventDefault() + e.stopPropagation() + this.save() + } + }, + focus: function(){ this.$el.addClass('focused') $("[name=comment]").prop("required", false) -- cgit v1.2.3-70-g09d2