Merge pull request #3274 from matrix-org/bwindels/fixpostcodeblocknewline

Fix newline not being appended to code block while converting message to markdown
This commit is contained in:
Bruno Windels 2019-08-05 08:19:42 +00:00 committed by GitHub
commit 98c0232a96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,8 +192,11 @@ function parseHtmlMessage(html, partCreator) {
if (lastNode && lastNode.nodeName === "BLOCKQUOTE") {
parts.push(partCreator.newline());
}
lastNode = null;
return checkDecendInto(n);
const decend = checkDecendInto(n);
// when not decending (like for PRE), onNodeLeave won't be called to set lastNode
// so do that here.
lastNode = decend ? null : n;
return decend;
}
function onNodeLeave(n) {