From: Michael M Slusarz Date: Mon, 30 Mar 2009 23:12:08 +0000 (-0600) Subject: Implement spellcheck on send for dimp X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c07c866e16347611ebcbf0f7a8dea7d246c8ca43;p=horde.git Implement spellcheck on send for dimp --- diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index bb6857e0f..80e8affad 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,7 @@ v5.0-git -------- +[mms] Implement spellcheck on send in DIMP. [mms] Sanity check - don't do message operations reliant on UID list if UIDVALIDITY of mailbox has changed. [mms] Simplify forwarding - always attach entire message. diff --git a/imp/js/src/compose-dimp.js b/imp/js/src/compose-dimp.js index 791192b00..d33c5e590 100644 --- a/imp/js/src/compose-dimp.js +++ b/imp/js/src/compose-dimp.js @@ -11,7 +11,7 @@ var DimpCompose = { // Variables defaulting to empty/false: // auto_save_interval, button_pressed, compose_cursor, dbtext, // editor_on, mp_padding, resizebcc, resizecc, resizeto, row_height, - // sbtext, uploading + // sbtext, skip_spellcheck, spellcheck, uploading last_msg: '', textarea_ready: true, @@ -126,16 +126,16 @@ var DimpCompose = { var db, params, sb, c = $('compose'); - if (DIMP.SpellCheckerObject) { + if (DIMP.SpellCheckerObject && + DIMP.SpellCheckerObject.isActive()) { DIMP.SpellCheckerObject.resume(); + this.skip_spellcheck = true; if (!this.textarea_ready) { this.uniqueSubmit.bind(this, action).defer(); return; } } - c.setStyle({ cursor: 'wait' }); - if (action == 'send_message' || action == 'save_draft') { this.button_pressed = true; @@ -146,6 +146,14 @@ var DimpCompose = { return; } + if (!this.skip_spellcheck && + DIMP.conf_compose.spellcheck && + DIMP.SpellCheckerObject && + !DIMP.SpellCheckerObject.isActive()) { + DIMP.SpellCheckerObject.spellCheck(this.onNoSpellError.bind(this, action)); + return; + } + if (!this.sbtext) { sb = $('send_button'); this.sbtext = sb.getText(); @@ -168,6 +176,9 @@ var DimpCompose = { return; } } + + c.setStyle({ cursor: 'wait' }); + this.skip_spellcheck = false; $('action').setValue(action); if (action == 'add_attachment') { @@ -286,6 +297,12 @@ var DimpCompose = { DimpCore.showNotifications(r.msgs); }, + onNoSpellError: function(action) + { + this.skip_spellcheck = true; + this.uniqueSubmit(action); + }, + toggleHtmlEditor: function(noupdate) { if (!DIMP.conf_compose.rte_avail) { diff --git a/imp/lib/DIMP.php b/imp/lib/DIMP.php index 75250ce21..2b8d8fb67 100644 --- a/imp/lib/DIMP.php +++ b/imp/lib/DIMP.php @@ -259,7 +259,7 @@ class DIMP 'attach_limit' => ($conf['compose']['attach_count_limit'] ? intval($conf['compose']['attach_count_limit']) : -1), 'close_draft' => $prefs->getValue('close_draft'), 'compose_cursor' => ($compose_cursor ? $compose_cursor : 'top'), - + 'spellcheck' => intval($prefs->getValue('compose_spellcheck')), ); if ($registry->hasMethod('contacts/search')) {