fix(@desktop/chat): Do not allow send empty message

This commit is contained in:
mprakhov 2022-12-21 23:23:35 +02:00 committed by Jonathan Rainville
parent 8b3319a1f3
commit e378cb4fd9
1 changed files with 6 additions and 0 deletions

View File

@ -342,10 +342,16 @@ Rectangle {
function onKeyPress(event) { function onKeyPress(event) {
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) { if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
if (getPlainText().trim() === "") {
event.accepted = true;
return
}
if (checkTextInsert()) { if (checkTextInsert()) {
event.accepted = true; event.accepted = true;
return return
} }
if (messageInputField.length <= messageLimit) { if (messageInputField.length <= messageLimit) {
control.sendMessage(event) control.sendMessage(event)
control.hideExtendedArea(); control.hideExtendedArea();