From 1f019c8e5886461eb1ab0c053d88527d45ccacde Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 05 May 2010 15:14:53 -0400
Subject: [PATCH] - Set focus to editor on reply in HTML mode (#1486632) - Fix composing in HTML jumps cursor to body instead of recipients (#1486674)

---
 program/js/editor.js |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/program/js/editor.js b/program/js/editor.js
index 1b1129e..34511ce 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -63,11 +63,18 @@
 // react to real individual tinyMCE editor init
 function rcmail_editor_callback(editor)
 {
-  var input_from = rcube_find_object('_from');
-  if (input_from && input_from.type=='select-one')
-    rcmail.change_identity(input_from);
+  var editor, elem = rcube_find_object('_from');
+  if (elem && elem.type=='select-one')
+    rcmail.change_identity(elem);
   // set tabIndex
   rcmail_editor_tabindex();
+  // set focus to element that was focused before
+  if (elem = rcmail.env.compose_focus_elem) {
+    if (elem.id == rcmail.env.composebody && (editor = tinyMCE.get(rcmail.env.composebody)))
+      editor.getWin().focus();
+    else
+      elem.focus();
+  }
 }
 
 // set tabIndex on tinyMCE editor

--
Gitblit v1.9.1