Prevent extra newline at end

This commit is contained in:
M66B 2020-08-03 22:52:46 +02:00
parent 8c1866f266
commit 263c10f594
1 changed files with 6 additions and 0 deletions

View File

@ -289,6 +289,12 @@ public class HtmlHelper {
static Document sanitizeCompose(Context context, String html, boolean show_images) {
try {
Document parsed = JsoupEx.parse(html);
// Prevent extra newline at end
Element body = parsed.body();
if (body != null && body.childrenSize() == 1 && "p".equals(body.child(0).tagName()))
body.child(0).tagName("span").appendChild(new Element("br"));
return sanitize(context, parsed, false, show_images);
} catch (Throwable ex) {
// OutOfMemoryError