check if content isn't just whitespaces (client side this time)

Signed-off-by: carsand101 <carsand101@noreply.codeberg.org>
This commit is contained in:
carsand101 2023-07-11 22:30:31 +00:00
parent 232798fa17
commit 38e2c74f47
1 changed files with 94 additions and 89 deletions

View File

@ -72,9 +72,14 @@ async function sendMessage(content, id) {
messageBox.addEventListener("keyup", function onEvent(event) { messageBox.addEventListener("keyup", function onEvent(event) {
if (event.key === "Enter") { if (event.key === "Enter") {
sendMessage(messageBox.value, channelID) if (!messageBox.value.trim().length == 0) {
updateMessages(channelID) sendMessage(messageBox.value, channelID)
messageBox.value = "" updateMessages(channelID)
messageBox.value = ""
}
else {
return;
}
} }
}) })