From 2646009826ee2d14cfa5cdb234b0f36930ba77e4 Mon Sep 17 00:00:00 2001 From: mic Date: Mon, 29 Jul 2024 23:18:56 +0200 Subject: [PATCH] prevent to send empty messages --- api_webchat/messageInput.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api_webchat/messageInput.js b/api_webchat/messageInput.js index 944fbcbb..4533ac43 100644 --- a/api_webchat/messageInput.js +++ b/api_webchat/messageInput.js @@ -138,6 +138,10 @@ class MessageInput extends HTMLElement { } _handleNewChatMessage() { + //do nothing if input is empty + if ((!this._messageInputField.value)||(this._messageInputField.value.trim().length === 0)) { + return; + } // prevent user from interacting while we're waiting this._sendButton.setAttribute('disabled', 'disabled'); this._messageInputField.setAttribute('disabled', 'disabled');