From 340546c975bca94526a3e16039895a6d0600828b Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 31 May 2011 03:38:56 -0400
Subject: [PATCH] - Optimization for spellcheck_before_send: don't invoke new ajax request. While we already have mispellings, we can return them and enable spellchecker directly without querying the server again

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

diff --git a/program/js/app.js b/program/js/app.js
index 5f5473a..32d7a63 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3018,6 +3018,24 @@
     }
   };
 
+  // resume spellchecking, highlight provided mispellings without new ajax request
+  this.spellcheck_resume = function(ishtml, data)
+  {
+    if (ishtml) {
+      var ed = tinyMCE.get(this.env.composebody);
+        sp = ed.plugins.spellchecker;
+
+      sp.active = 1;
+      sp._markWords(data);
+      ed.nodeChanged();
+    }
+    else {
+      var sp = this.env.spellcheck;
+      sp.prepare(false, true);
+      sp.processData(data);
+    }
+  }
+
   this.set_draft_id = function(id)
   {
     $("input[name='_draft_saveid']").val(id);

--
Gitblit v1.9.1