forked from Ivasoft/mattermost-mobile
MM-53343 - save button not grayed out when edit message is too long (#7446)
* MM-53343 - save button not grayed out when edit message is too long * fix too long message not getting removed
This commit is contained in:
committed by
GitHub
parent
fa43f68a8f
commit
84b35ac143
@@ -110,13 +110,15 @@ const EditPost = ({componentId, maxPostSize, post, closeButtonId, hasFilesAttach
|
||||
|
||||
const onChangeTextCommon = useCallback((message: string) => {
|
||||
const tooLong = message.trim().length > maxPostSize;
|
||||
setErrorLine(undefined);
|
||||
setErrorExtra(undefined);
|
||||
if (tooLong) {
|
||||
const line = intl.formatMessage({id: 'mobile.message_length.message_split_left', defaultMessage: 'Message exceeds the character limit'});
|
||||
const extra = `${message.trim().length} / ${maxPostSize}`;
|
||||
setErrorLine(line);
|
||||
setErrorExtra(extra);
|
||||
}
|
||||
toggleSaveButton(editingMessage !== message);
|
||||
toggleSaveButton(editingMessage !== message && !tooLong);
|
||||
}, [intl, maxPostSize, editingMessage, toggleSaveButton]);
|
||||
|
||||
const onAutocompleteChangeText = useCallback((message: string) => {
|
||||
|
||||
Reference in New Issue
Block a user