From 5cff852b07b83ddf330fcaffd0843eb3cad6d5ee Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sat, 31 Jul 2010 05:48:46 -0400
Subject: [PATCH] Disable active spell check in tinyMCE before switching to plaintext mode (#1486870) + focus message field after mode switch

---
 program/js/app.js |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index a9da557..c4ddb21 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2815,13 +2815,14 @@
       tinyMCE.execCommand('mceAddControl', false, props.id);
     }
     else {
-      var thisMCE = tinyMCE.get(props.id),
-        existingHtml = thisMCE.getContent();
-
-      if (existingHtml) {
+      var thisMCE = tinyMCE.get(props.id), existingHtml;
+      if (thisMCE.plugins.spellchecker && thisMCE.plugins.spellchecker.active)
+        thisMCE.execCommand('mceSpellCheck', false);
+      
+      if (existingHtml = thisMCE.getContent()) {
         if (!confirm(this.get_label('editorwarning'))) {
           return false;
-	    }
+        }
         this.html2plain(existingHtml, props.id);
       }
       tinyMCE.execCommand('mceRemoveControl', false, props.id);

--
Gitblit v1.9.1