Trim trailing newlines from outgoing messages

This commit is contained in:
Chris Svenningsen 2020-11-11 14:56:20 -08:00 committed by GitHub
parent fef8c5b2f1
commit 98da8746e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -57,7 +57,8 @@ export const getTextFromOps = (ops: Array<DeltaOperation>): string =>
break;
}
}
return acc + textToAdd;
const textWithoutNewlines = textToAdd.replace(/\n+$/, '');
return acc + textWithoutNewlines;
}
if (insert.emoji) {
@ -93,7 +94,9 @@ export const getTextAndMentionsFromOps = (
break;
}
}
return acc + textToAdd;
const textWithoutNewlines = textToAdd.replace(/\n+$/, '');
return acc + textWithoutNewlines;
}
if (isInsertEmojiOp(op)) {