summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-30 17:08:47 +0000
committeralecpl <alec@alec.pl>2011-05-30 17:08:47 +0000
commit644e3ad91250c0cb7b291b48e3b5cef401bffd90 (patch)
tree6027a214fe6a422e19a397e30c260f1a4129203a /program/js
parent1d5779b2577453a1000f38fa987bb0eafd3c554f (diff)
- Fix setting language for spellchecker on spellcheck_before_send
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js16
-rw-r--r--program/js/googiespell.js10
2 files changed, 20 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js
index ea54b0b78..5f5473a1b 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -890,12 +890,14 @@ function rcube_webmail()
self.clearTimeout(this.save_timer);
// all checks passed, send message
- var form = this.gui_objects.messageform,
+ var lang = this.spellcheck_lang(),
+ form = this.gui_objects.messageform,
msgid = this.set_busy(true, 'sendingmessage');
form.target = 'savetarget';
form._draft.value = '';
form.action = this.add_url(form.action, '_unlock', msgid);
+ form.action = this.add_url(form.action, '_lang', lang);
form.submit();
// clear timeout (sending could take longer)
@@ -3004,6 +3006,18 @@ function rcube_webmail()
this.enable_command('spellcheck', this.spellcheck_ready);
};
+ // get selected language
+ this.spellcheck_lang = function()
+ {
+ var ed;
+ if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins.spellchecker) {
+ return ed.plugins.spellchecker.selectedLang;
+ }
+ else if (this.env.spellcheck) {
+ return GOOGIE_CUR_LANG;
+ }
+ };
+
this.set_draft_id = function(id)
{
$("input[name='_draft_saveid']").val(id);
diff --git a/program/js/googiespell.js b/program/js/googiespell.js
index 22716c457..d6aea48ba 100644
--- a/program/js/googiespell.js
+++ b/program/js/googiespell.js
@@ -10,8 +10,8 @@
Aleksander Machniak - alec [at] alec.pl
*/
-var SPELL_CUR_LANG = null;
-var GOOGIE_DEFAULT_LANG = 'en';
+var GOOGIE_CUR_LANG,
+ GOOGIE_DEFAULT_LANG = 'en';
function GoogieSpell(img_dir, server_url) {
var ref = this,
@@ -260,9 +260,9 @@ this.spellCheck = function(ignore) {
ref.resumeEditingState();
} else {
if (!ref.custom_no_spelling_error)
- ref.flashNoSpellingErrorState();
- else
- ref.custom_no_spelling_error(ref);
+ ref.flashNoSpellingErrorState();
+ else
+ ref.custom_no_spelling_error(ref);
}
ref.removeIndicator();
}