submit on ctrl-enter

main
Cogent Apps 2023-04-29 18:51:54 +00:00
parent 16ad81f403
commit 6b271a41c1
1 changed files with 2 additions and 0 deletions

View File

@ -263,6 +263,8 @@ export default function MessageInput(props: MessageInputProps) {
const hotkeyHandler = useMemo(() => { const hotkeyHandler = useMemo(() => {
const keys = [ const keys = [
['Escape', blur, { preventDefault: true }], ['Escape', blur, { preventDefault: true }],
['ctrl+Enter', onSubmit, { preventDefault: true }],
]; ];
if (submitOnEnter) { if (submitOnEnter) {
keys.unshift(['Enter', onSubmit, { preventDefault: true }]); keys.unshift(['Enter', onSubmit, { preventDefault: true }]);