Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-04-15 00:53:35 +01:00
parent f1def8b0de
commit cb10640eaf
1 changed files with 4 additions and 5 deletions

View File

@ -132,10 +132,10 @@ function parseElement(n: HTMLElement, partCreator: PartCreator, lastNode: HTMLEl
} }
case "OL": case "OL":
state.listIndex.push((<HTMLOListElement>n).start || 1); state.listIndex.push((<HTMLOListElement>n).start || 1);
// fallthrough /* falls through */
case "UL": case "UL":
state.listDepth = (state.listDepth || 0) + 1; state.listDepth = (state.listDepth || 0) + 1;
// fallthrough /* falls through */
default: default:
// don't textify block nodes we'll descend into // don't textify block nodes we'll descend into
if (!checkDescendInto(n)) { if (!checkDescendInto(n)) {
@ -244,7 +244,7 @@ function parseHtmlMessage(html: string, partCreator: PartCreator, isQuotedMessag
break; break;
case "OL": case "OL":
state.listIndex.pop(); state.listIndex.pop();
// fallthrough /* falls through */
case "UL": case "UL":
state.listDepth -= 1; state.listDepth -= 1;
break; break;
@ -259,7 +259,7 @@ function parseHtmlMessage(html: string, partCreator: PartCreator, isQuotedMessag
export function parsePlainTextMessage(body: string, partCreator: PartCreator, isQuotedMessage: boolean) { export function parsePlainTextMessage(body: string, partCreator: PartCreator, isQuotedMessage: boolean) {
const lines = body.split(/\r\n|\r|\n/g); // split on any new-line combination not just \n, collapses \r\n const lines = body.split(/\r\n|\r|\n/g); // split on any new-line combination not just \n, collapses \r\n
const parts = lines.reduce((parts, line, i) => { return lines.reduce((parts, line, i) => {
if (isQuotedMessage) { if (isQuotedMessage) {
parts.push(partCreator.plain(QUOTE_LINE_PREFIX)); parts.push(partCreator.plain(QUOTE_LINE_PREFIX));
} }
@ -270,7 +270,6 @@ export function parsePlainTextMessage(body: string, partCreator: PartCreator, is
} }
return parts; return parts;
}, []); }, []);
return parts;
} }
export function parseEvent(event: MatrixEvent, partCreator: PartCreator, {isQuotedMessage = false} = {}) { export function parseEvent(event: MatrixEvent, partCreator: PartCreator, {isQuotedMessage = false} = {}) {