mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 02:51:57 +02:00
Prevent submitting comment on enter if input is empty (#23221)
* Prevent submitting comment on enter if input is empty * check for content in keyPress event GitOrigin-RevId: 1abef229782265836a49d74aa93625797d50dc3a
This commit is contained in:
committed by
Copybot
parent
7d2a2b78ee
commit
681d6d8192
@@ -12,7 +12,9 @@ export default function useSubmittableTextInput(
|
||||
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
|
||||
e.preventDefault()
|
||||
handleSubmit(content, setContent)
|
||||
if (content.trim().length > 0) {
|
||||
handleSubmit(content, setContent)
|
||||
}
|
||||
}
|
||||
},
|
||||
[content, handleSubmit]
|
||||
|
||||
Reference in New Issue
Block a user