From 4d02384dcaba8806113a5554ea2faf2c011d2f4e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 05 May 2014 09:46:29 -0400
Subject: [PATCH] Fix Spell button with TinyMCE4

---
 program/js/app.js |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 0588eb4..43dba14 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3540,7 +3540,7 @@
     var ed;
 
     if (window.tinymce && (ed = tinymce.get(this.env.composebody))) {
-      if (ed.plugins && ed.plugins.spellchecker && ed.plugins.spellchecker.active)
+      if (ed.plugins && ed.plugins.spellchecker && this.env.spellcheck_active)
         ed.execCommand('mceSpellCheck');
     }
     else if (ed = this.env.spellcheck) {
@@ -3555,8 +3555,8 @@
   {
     var ed, active;
 
-    if (window.tinymce && (ed = tinymce.get(this.env.composebody)) && ed.plugins && ed.plugins.spellchecker)
-      active = ed.plugins.spellchecker.active;
+    if (window.tinymce && (ed = tinymce.get(this.env.composebody)))
+      active = this.env.spellcheck_active;
     else if ((ed = this.env.spellcheck) && ed.state)
       active = ed.state != 'ready' && ed.state != 'no_error_found';
 
@@ -3571,8 +3571,8 @@
   {
     var ed;
 
-    if (window.tinymce && (ed = tinymce.get(this.env.composebody)) && ed.plugins && ed.plugins.spellchecker)
-      return ed.plugins.spellchecker.selectedLang;
+    if (window.tinymce && (ed = tinymce.get(this.env.composebody)))
+      return ed.settings.spellchecker_language || this.env.spell_lang;
     else if (this.env.spellcheck)
       return GOOGIE_CUR_LANG;
   };
@@ -3581,8 +3581,8 @@
   {
     var ed;
 
-    if (window.tinymce && (ed = tinymce.get(this.env.composebody)) && ed.plugins)
-      ed.plugins.spellchecker.selectedLang = lang;
+    if (window.tinymce && (ed = tinymce.get(this.env.composebody)))
+      ed.settings.spellchecker_language = lang;
     else if (this.env.spellcheck)
       this.env.spellcheck.setCurrentLanguage(lang);
   };

--
Gitblit v1.9.1