fix: prevents messages ending with spaces to exceed the msg limit
This commit is contained in:
parent
31c5f8241c
commit
7ac22eb889
@ -148,8 +148,7 @@ export default class ChatInput extends Component {
|
|||||||
|
|
||||||
handleMessageInputKeydown(event) {
|
handleMessageInputKeydown(event) {
|
||||||
const formField = this.formMessageInput.current;
|
const formField = this.formMessageInput.current;
|
||||||
|
let textValue = formField.textContent; // get this only to count chars
|
||||||
let textValue = formField.innerText.trim(); // get this only to count chars
|
|
||||||
const newStates = {};
|
const newStates = {};
|
||||||
let numCharsLeft = CHAT_MAX_MESSAGE_LENGTH - textValue.length;
|
let numCharsLeft = CHAT_MAX_MESSAGE_LENGTH - textValue.length;
|
||||||
const key = event && event.key;
|
const key = event && event.key;
|
||||||
@ -174,7 +173,7 @@ export default class ChatInput extends Component {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// value could have been changed, update char count
|
// value could have been changed, update char count
|
||||||
textValue = formField.innerText.trim();
|
textValue = formField.textContent;
|
||||||
numCharsLeft = CHAT_MAX_MESSAGE_LENGTH - textValue.length;
|
numCharsLeft = CHAT_MAX_MESSAGE_LENGTH - textValue.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +192,7 @@ export default class ChatInput extends Component {
|
|||||||
|
|
||||||
handleMessageInputKeyup(event) {
|
handleMessageInputKeyup(event) {
|
||||||
const formField = this.formMessageInput.current;
|
const formField = this.formMessageInput.current;
|
||||||
const textValue = formField.innerText.trim(); // get this only to count chars
|
const textValue = formField.textContent; // get this only to count chars
|
||||||
|
|
||||||
const { key } = event;
|
const { key } = event;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user