diff options
author | alecpl <alec@alec.pl> | 2008-10-01 08:29:58 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2008-10-01 08:29:58 +0000 |
commit | f4b8681160110659f5f78b309237de6f43c32537 (patch) | |
tree | 827c92e75f9c0c11385c1924817c136dda16d733 | |
parent | ef925ffe08cf221f1415fb8405ad4fb229172139 (diff) |
- Stop spellchecking when switching to html editor (#1485362)
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | program/js/app.js | 7 | ||||
-rw-r--r-- | program/js/common.js | 17 | ||||
-rw-r--r-- | program/js/editor.js | 2 |
4 files changed, 28 insertions, 1 deletions
@@ -1,6 +1,9 @@ CHANGELOG RoundCube Webmail --------------------------- +2008/10/01 (alec) +- Stop spellchecking when switching to html editor (#1485362) + 2008/09/29 (alec) ---------- - Added 'mime_param_folding' option with possibility to choose diff --git a/program/js/app.js b/program/js/app.js index 8ba00784f..bcc5e5071 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1971,6 +1971,13 @@ function rcube_webmail() this.display_spellcheck_controls = function(vis) { if (this.env.spellcheck) { + // stop spellchecking process + if (!vis && !this.spellcheck_ready) + { + exec_event(this.env.spellcheck.check_link, 'click'); + this.set_spellcheck_state('ready'); + } + this.env.spellcheck.check_link.style.visibility = vis ? 'visible' : 'hidden'; this.env.spellcheck.switch_lan_pic.style.visibility = vis ? 'visible' : 'hidden'; } diff --git a/program/js/common.js b/program/js/common.js index 5049061b4..4b877bac3 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -650,3 +650,20 @@ if (bw.ie) return o; } } + + +// Fire event on specified element +function exec_event(element,event) +{ + if (document.createEventObject) { + // dispatch for IE + var evt = document.createEventObject(); + return element.fireEvent('on'+event,evt) + } + else { + // dispatch for firefox + others + var evt = document.createEvent("HTMLEvents"); + evt.initEvent(event, true, true); // event type,bubbling,cancelable + return !element.dispatchEvent(evt); + } +} diff --git a/program/js/editor.js b/program/js/editor.js index ceab021ef..a9aec621c 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -58,12 +58,12 @@ function rcmail_toggle_editor(toggler) // do the appropriate conversion if (selectedEditor == 'html') { + rcmail.display_spellcheck_controls(false); var composeElement = document.getElementById('compose-body'); var htmlText = "<pre>" + composeElement.value + "</pre>"; composeElement.value = htmlText; tinyMCE.execCommand('mceAddControl', true, 'compose-body'); htmlFlag.value = "1"; - rcmail.display_spellcheck_controls(false); } else { |