summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-10-29 10:33:13 +0100
committerAleksander Machniak <alec@alec.pl>2014-10-29 10:33:13 +0100
commit0b96b1cd81d244af74ed8229fae1d64ebc6a205d (patch)
treeb8bc9fee159b2ddd667c4cbc785b5cd7de60a6fb /program
parentd93019125cca783e8acfaa68467024375321e55f (diff)
Fix reply scrolling issue with text mode and start message below the quote (#1490114)
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js11
-rw-r--r--program/steps/mail/compose.inc11
2 files changed, 17 insertions, 5 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 0fe485a4a..31544abf0 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3319,7 +3319,7 @@ function rcube_webmail()
if (!this.gui_objects.messageform)
return false;
- var i, input_from = $("[name='_from']"),
+ var i, pos, input_from = $("[name='_from']"),
input_to = $("[name='_to']"),
input_subject = $("input[name='_subject']"),
input_message = $("[name='_message']").get(0),
@@ -3353,12 +3353,19 @@ function rcube_webmail()
}
if (!html_mode) {
- this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length);
+ pos = this.env.top_posting ? 0 : input_message.value.length;
+ this.set_caret_pos(input_message, pos);
+
// add signature according to selected identity
// if we have HTML editor, signature is added in callback
if (input_from.prop('type') == 'select-one') {
this.change_identity(input_from[0]);
}
+
+ // scroll to the bottom of the textarea (#1490114)
+ if (pos) {
+ $(input_message).scrollTop(input_message.scrollHeight);
+ }
}
// check for locally stored compose data
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 9b6d0dcc9..e5c2fb108 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -986,6 +986,8 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
)
));
+ $reply_mode = intval($RCMAIL->config->get('reply_mode'));
+
if (!$bodyIsHtml) {
$body = preg_replace('/\r?\n/', "\n", $body);
$body = trim($body, "\n");
@@ -994,10 +996,13 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
$body = rcmail_wrap_and_quote($body, $LINE_LENGTH);
$prefix .= "\n";
- $suffix = '';
- if (intval($RCMAIL->config->get('reply_mode')) > 0) { // top-posting
+ if ($reply_mode > 0) { // top-posting
$prefix = "\n\n\n" . $prefix;
+ $suffix = '';
+ }
+ else {
+ $suffix = "\n";
}
}
else {
@@ -1012,7 +1017,7 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
$prefix = '<p>' . rcube::Q($prefix) . "</p>\n";
$prefix .= '<blockquote>';
- if (intval($RCMAIL->config->get('reply_mode')) > 0) { // top-posting
+ if ($reply_mode > 0) { // top-posting
$prefix = '<br>' . $prefix;
$suffix = '</blockquote>';
}