Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 9b38080

Browse files
author
robjloranger
committed
add key shortcut for submitting from compose
this adds an event listener on the text area of the composer it listens for a keydown event with both <enter> and either <control> on windows and linux or <command> on osx then it fires the locally scoped method 'publish' and prevents default event handling
1 parent d3bfb19 commit 9b38080

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/message/html/compose.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ exports.create = function (api) {
5959
if (!files || !files.length) return
6060
attachFiles(files)
6161
},
62+
'ev-keydown': ev => {
63+
if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey)) {
64+
publish()
65+
ev.preventDefault()
66+
}
67+
},
6268
disabled: publishing,
6369
placeholder
6470
})

0 commit comments

Comments
 (0)