Trim leading and trailing whitespace on message composition and display.

This commit is contained in:
Ian Macdonald 2022-06-04 16:35:17 +02:00
parent 3ecdb659d8
commit aeb5caf921
No known key found for this signature in database
GPG Key ID: AE4C20556BA626FA
2 changed files with 2 additions and 2 deletions

View File

@ -843,7 +843,7 @@ class CompositionBoxInner extends React.Component<Props, State> {
// this does not call call removeAllStagedAttachmentsInConvers
const { attachments, previews } = await this.getFiles(linkPreview);
this.props.sendMessage({
body: messagePlaintext,
body: messagePlaintext.trim(),
attachments: attachments || [],
quote: extractedQuotedMessageProps,
preview: previews,

View File

@ -31,7 +31,7 @@ export const MessageText = (props: Props) => {
? window.i18n('messageDeletedPlaceholder')
: direction === 'incoming' && status === 'error'
? window.i18n('incomingError')
: text;
: text?.trim();
if (!contents) {
return null;