summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-08-15 21:47:31 +0000
committerthomascube <thomas@roundcube.net>2008-08-15 21:47:31 +0000
commit4ca10b8d511d85a4d575af355b0a6739d5a05958 (patch)
tree236a88fa81e490b751f30a8205b142866503787d /program/steps
parentd4c01cadbdcd871f6d1c289c77dbd399d202aefd (diff)
Enable spellchecker for HTML editor
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/compose.inc19
1 files changed, 11 insertions, 8 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 8e5a7c2ef..06e9d0332 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -382,7 +382,7 @@ function rcmail_compose_body($attrib)
$OUTPUT->include_script('tiny_mce/tiny_mce.js');
$OUTPUT->include_script("editor.js");
- $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.$tinylang.'");');
+ $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.JQ($tinylang).'", '.intval($CONFIG['enable_spellcheck']).');');
$out = $form_start ? "$form_start\n" : '';
@@ -402,11 +402,13 @@ function rcmail_compose_body($attrib)
$out .= $form_end ? "\n$form_end" : '';
// include GoogieSpell
- if (!empty($CONFIG['enable_spellcheck']) && !$isHtml)
- {
- $lang_set = '';
- if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages']))
- $lang_set = "googie.setLanguages(".array2js($CONFIG['spellcheck_languages']).");\n";
+ if (!empty($CONFIG['enable_spellcheck'])) {
+ $googie_lang_set = $editor_lang_set = '';
+ if (!empty($CONFIG['spellcheck_languages']) && is_array($CONFIG['spellcheck_languages'])) {
+ $googie_lang_set = "googie.setLanguages(".json_serialize($CONFIG['spellcheck_languages']).");\n";
+ foreach ($CONFIG['spellcheck_languages'] as $key => $name)
+ $editor_lang_set .= ($editor_lang_set ? ',' : '') . ($key == $tinylang ? '+' : '') . JQ($name).'='.JQ($key);
+ }
$OUTPUT->include_script('googiespell.js');
$OUTPUT->add_script(sprintf(
@@ -425,13 +427,14 @@ function rcmail_compose_body($attrib)
JQ(Q(rcube_label('close'))),
JQ(Q(rcube_label('revertto'))),
JQ(Q(rcube_label('nospellerrors'))),
- $lang_set,
+ $googie_lang_set,
substr($_SESSION['language'], 0, 2),
$attrib['id'],
JS_OBJECT_NAME), 'foot');
rcube_add_label('checking');
- }
+ $OUTPUT->set_env('spellcheck_langs', $editor_lang_set);
+ }
$out .= "\n".'<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;border:none;visibility:hidden;"></iframe>';