mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
improve stripPlainReply comment and fix leading NewLine
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
68dd57f56e
commit
2e29a0857b
@ -158,8 +158,11 @@ export default class ReplyThread extends React.Component {
|
|||||||
|
|
||||||
// Part of Replies fallback support
|
// Part of Replies fallback support
|
||||||
static stripPlainReply(body) {
|
static stripPlainReply(body) {
|
||||||
|
// Removes lines beginning with `> ` until you reach one that doesn't.
|
||||||
const lines = body.split('\n');
|
const lines = body.split('\n');
|
||||||
while (lines.length && lines[0].startsWith('> ')) lines.shift();
|
while (lines.length && lines[0].startsWith('> ')) lines.shift();
|
||||||
|
// Reply fallback has a blank line after it, so remove it to prevent leading newline
|
||||||
|
if (lines[0] === '') lines.shift();
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user