diff --git a/web/chat/edit-text-message.react.js b/web/chat/edit-text-message.react.js --- a/web/chat/edit-text-message.react.js +++ b/web/chat/edit-text-message.react.js @@ -45,6 +45,10 @@ [threadColor], ); + const isMessageEmpty = React.useMemo(() => { + return trimMessage(editedMessageDraft) === ''; + }, [editedMessageDraft]); + const isMessageEdited = React.useMemo(() => { const { messageInfo } = item; if (!messageInfo || !messageInfo.text || !editState) { @@ -59,6 +63,9 @@ const checkAndEdit = async () => { const { id: messageInfoID } = item.messageInfo; + if (isMessageEmpty) { + return; + } if (!isMessageEdited) { clearEditModal(); return; @@ -149,6 +156,7 @@ variant="filled" buttonColor={saveButtonColor} onClick={checkAndEdit} + disabled={isMessageEmpty} > Save (enter)