From 51498a2dc37987f55b022efb961b68a282be17ed Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 19 Nov 2020 11:41:47 -0500 Subject: [PATCH] JS enhancements to encourage bottom-posting --- plugins/base/smtp.go | 1 + themes/alps/assets/compose.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/plugins/base/smtp.go b/plugins/base/smtp.go index 14bff07..f098506 100644 --- a/plugins/base/smtp.go +++ b/plugins/base/smtp.go @@ -26,6 +26,7 @@ func quote(r io.Reader) (string, error) { if err := scanner.Err(); err != nil { return "", fmt.Errorf("quote: failed to read original message: %s", err) } + builder.WriteString("\n") return builder.String(), nil } diff --git a/themes/alps/assets/compose.js b/themes/alps/assets/compose.js index a980d77..23e67b6 100644 --- a/themes/alps/assets/compose.js +++ b/themes/alps/assets/compose.js @@ -1,3 +1,11 @@ +const textarea = document.querySelector("textarea.body"); +if (window.location.pathname.endsWith("/reply")) { + // Auto-focus body and scroll to bottom + textarea.focus(); + textarea.setSelectionRange(textarea.value.length, textarea.value.length); + textarea.scrollTop = textarea.scrollHeight; +} + const sendButton = document.getElementById("send-button"), saveButton = document.getElementById("save-button");