From 64a92fadeb95d608a234954d6f7a43bd69cf4bd0 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 17 Oct 2022 15:42:12 -0400 Subject: [PATCH] feat: ctrl-enter shortcut for quick reply --- public/modules/quickreply.js | 13 +++++++++++-- templates/partials/topic/quickreply.tpl | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/public/modules/quickreply.js b/public/modules/quickreply.js index 603c44e..82e9f2c 100644 --- a/public/modules/quickreply.js +++ b/public/modules/quickreply.js @@ -1,8 +1,12 @@ 'use strict'; define('persona/quickreply', [ - 'components', 'composer/autocomplete', 'api', 'alerts', 'uploadHelpers', -], function (components, autocomplete, api, alerts, uploadHelpers) { + 'components', 'composer/autocomplete', 'api', + 'alerts', 'uploadHelpers', 'mousetrap', +], function ( + components, autocomplete, api, + alerts, uploadHelpers, mousetrap +) { var QuickReply = {}; QuickReply.init = function () { @@ -27,6 +31,11 @@ define('persona/quickreply', [ // data.element.textcomplete(data.strategies, data.options); // $('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%'); + mousetrap.bind('ctrl+return', (e) => { + if (e.target === element.get(0)) { + components.get('topic/quickreply/button').get(0).click(); + } + }); uploadHelpers.init({ dragDropAreaEl: $('[component="topic/quickreply/container"] .quickreply-message'), diff --git a/templates/partials/topic/quickreply.tpl b/templates/partials/topic/quickreply.tpl index 93a9dc2..b527ca5 100644 --- a/templates/partials/topic/quickreply.tpl +++ b/templates/partials/topic/quickreply.tpl @@ -12,7 +12,7 @@
- +
[[topic:composer.drag_and_drop_images]]