diff options
author | alecpl <alec@alec.pl> | 2010-05-07 09:32:12 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-05-07 09:32:12 +0000 |
commit | 500af6fcf802671d505e3b98834aad3becc75b80 (patch) | |
tree | baf03bb2418f5d9668244f76337599750eb41e1f /program/js/app.js | |
parent | bec31a4e86ac0d6b569e7b9601b0bde4a0e26a16 (diff) |
- Fix adding signature above the body in plain-text mode
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/program/js/app.js b/program/js/app.js index ec7ec45e1..b9ae6326f 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2597,12 +2597,12 @@ function rcube_webmail() this.init_address_input_events($("[name='_bcc']")); if (!html_mode) { + this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); // add signature according to selected identity // if we have HTML editor, signature is added in callback if (input_from.attr('type') == 'select-one' && $("input[name='_draft_saveid']").val() == '') { this.change_identity(input_from[0]); } - this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); } if (input_to.val() == '') @@ -2779,16 +2779,14 @@ function rcube_webmail() if (!show_sig) show_sig = this.env.show_sig; - var sig, cursor_pos, p = -1, + var cursor_pos, p = -1, id = obj.options[obj.selectedIndex].value, input_message = $("[name='_message']"), message = input_message.val(), is_html = ($("input[name='_is_html']").val() == '1'), + sig = this.env.identity, sig_separator = this.env.sig_above && (this.env.compose_mode == 'reply' || this.env.compose_mode == 'forward') ? '---' : '-- '; - if (!this.env.identity) - this.env.identity = id - // enable manual signature insert if (this.env.signatures && this.env.signatures[id]) this.enable_command('insert-sig', true); @@ -2797,8 +2795,8 @@ function rcube_webmail() if (!is_html) { // remove the 'old' signature - if (show_sig && this.env.identity && this.env.signatures && this.env.signatures[this.env.identity]) { - sig = this.env.signatures[this.env.identity].is_html ? this.env.signatures[this.env.identity].plain_text : this.env.signatures[this.env.identity].text; + if (show_sig && sig && this.env.signatures && this.env.signatures[sig]) { + sig = this.env.signatures[sig].is_html ? this.env.signatures[sig].plain_text : this.env.signatures[sig].text; sig = sig.replace(/\r\n/, '\n'); if (!sig.match(/^--[ -]\n/)) |