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,10 +72,15 @@ 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") {
if (!messageBox.value.trim().length == 0) {
sendMessage(messageBox.value, channelID) sendMessage(messageBox.value, channelID)
updateMessages(channelID) updateMessages(channelID)
messageBox.value = "" messageBox.value = ""
} }
else {
return;
}
}
}) })
function update() { function update() {