summaryrefslogtreecommitdiff
path: root/program/js/app.js
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/js/app.js
parentd4c01cadbdcd871f6d1c289c77dbd399d202aefd (diff)
Enable spellchecker for HTML editor
Diffstat (limited to 'program/js/app.js')
-rw-r--r--program/js/app.js31
1 files changed, 19 insertions, 12 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 998efd7a2..c82ebf948 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -195,6 +195,8 @@ function rcube_webmail()
{
this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); };
this.set_spellcheck_state('ready');
+ if (rcube_find_object('_is_html').value == '1')
+ this.display_spellcheck_controls(false);
}
if (this.env.drafts_mailbox)
this.enable_command('savedraft', true);
@@ -204,9 +206,9 @@ function rcube_webmail()
this.enable_command('select-all', 'select-none', 'expunge', true);
if (this.env.messagecount
- && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox
- || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter))
- || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter))))
+ && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox
+ || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter))
+ || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter))))
this.enable_command('purge', true);
this.set_page_buttons();
@@ -855,11 +857,13 @@ function rcube_webmail()
break;
case 'spellcheck':
- if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready)
- {
+ if (window.tinyMCE && tinyMCE.get('compose-body')) {
+ tinyMCE.execCommand('mceSpellCheck', true);
+ }
+ else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) {
this.env.spellcheck.spellCheck(this.env.spellcheck.check_link);
this.set_spellcheck_state('checking');
- }
+ }
break;
case 'savedraft':
@@ -1899,16 +1903,12 @@ function rcube_webmail()
}
// check for empty body
- if ((!window.tinyMCE || !tinyMCE.get('compose-body'))
- && input_message.value == ''
- && !confirm(this.get_label('nobodywarning')))
+ if ((!window.tinyMCE || !tinyMCE.get('compose-body')) && input_message.value == '' && !confirm(this.get_label('nobodywarning')))
{
input_message.focus();
return false;
}
- else if (window.tinyMCE && tinyMCE.get('compose-body')
- && !tinyMCE.get('compose-body').getContent()
- && !confirm(this.get_label('nobodywarning')))
+ else if (window.tinyMCE && tinyMCE.get('compose-body') && !tinyMCE.get('compose-body').getContent() && !confirm(this.get_label('nobodywarning')))
{
tinyMCE.get('compose-body').focus();
return false;
@@ -1917,6 +1917,13 @@ function rcube_webmail()
return true;
};
+ this.display_spellcheck_controls = function(vis)
+ {
+ if (this.env.spellcheck) {
+ this.env.spellcheck.check_link.style.visibility = vis ? 'visible' : 'hidden';
+ this.env.spellcheck.switch_lan_pic.style.visibility = vis ? 'visible' : 'hidden';
+ }
+ };
this.set_spellcheck_state = function(s)
{