From 79ea526d6546c2525cf8bdedeeda492d534ccc66 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 29 Sep 2017 08:57:03 +0200 Subject: [PATCH] Fix missing cursor in HTML editor on mail reply (#5969) --- CHANGELOG | 1 + program/js/app.js | 11 ++++++----- program/js/editor.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 46ac6e9a5f6..e591a25750e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -48,6 +48,7 @@ CHANGELOG Roundcube Webmail - Fix bug where HTML messages could have been rendered empty on some systems (#5957) - Fix wording of "Mark previewed messages as read" to "Mark messages as read" (#5952) - Enigma: Fix decryption of messages encoded with non-ascii charset (#5962) +- Fix missing cursor in HTML editor on mail reply (#5969) RELEASE 1.3.1 ------------- diff --git a/program/js/app.js b/program/js/app.js index d3f60725abf..2446a8b2ca3 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4276,9 +4276,7 @@ function rcube_webmail() else if (input_message) elem = input_message; - this.init_messageform_inputs(elem); - - this.env.compose_focus_elem = document.activeElement; + this.env.compose_focus_elem = this.init_messageform_inputs(elem); // get summary of all field values this.compose_field_hash(true); @@ -4308,8 +4306,11 @@ function rcube_webmail() this.init_address_input_events($("[name='_"+ac_fields[i]+"']"), ac_props); } - // focus first empty element - $(focused || input_to).focus(); + if (!focused) + focused = input_to; + + // focus first empty element (and return it) + return $(focused).focus().get(0); }; this.compose_restore_dialog = function(j, html_mode) diff --git a/program/js/editor.js b/program/js/editor.js index 696ee6a09bd..8fba63ec8e3 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -184,7 +184,7 @@ function rcube_text_editor(config, id) rcmail.change_identity(elem); // Focus previously focused element - if (fe && fe.id != this.id) { + if (fe && fe.id != this.id && fe.nodeName != 'BODY') { window.focus(); // for WebKit (#1486674) fe.focus(); rcmail.env.compose_focus_elem = null;