mozilla

Compare Revisions

Using spell checking in XUL

Change Revisions

Revision 81227:

Revision 81227 by Cfinke on

Revision 81228:

Revision 81228 by tito on

Title:
Using spell checking in XUL
Using spell checking in XUL
Slug:
Using_spell_checking_in_XUL
Using_spell_checking_in_XUL
Tags:
Extensions, Add-ons
Extensions, Add-ons
Content:

Revision 81227
Revision 81228
n8      The new spell checking functionality is available in <a hren8      The new spell checking functionality is available in <a hre
>f="en/Firefox_2">Firefox 2</a>. This document describes how to us>f="/en/Firefox_2_for_developers" title="en/Firefox_2_for_develope
>e the <code><a class="external" href="http://www.xulplanet.com/re>rs">Firefox 2</a>. This document describes how to use the <code><
>ferences/xpcomref/ifaces/mozISpellCheckingEngine.html">mozISpellC>a class="external" href="http://www.xulplanet.com/references/xpco
>heckingEngine</a></code> component to add spell checking capabili>mref/ifaces/mozISpellCheckingEngine.html">mozISpellCheckingEngine
>ties to your Firefox extension.></a></code> component to add spell checking capabilities to your 
 >Firefox extension.
n11      See <a href="en/Controlling_spell_checking_in_HTML_forms">Cn11      See <a href="/en/Controlling_spell_checking_in_HTML_forms" 
>ontrolling spell checking in HTML forms</a> for details on adding>title="en/Controlling_spell_checking_in_HTML_forms">Controlling s
> spell check support to HTML forms for your website.>pell checking in HTML forms</a> for details on adding spell check
 > support to HTML forms for your website.
nn18    </p>
19    <p>
20      Additionally you may want to check if the user added the wo
 >rd to the personal dictionary. (&nbsp;sometimes a word are correc
 >tly spelled but not recognized ).
n30if (gSpellCheckEngine.check("kat")) {n33if (gSpellCheckEngine.check("kat"))
34{
n33else {n37else
38{
39    // It's spelled incorrectly but check if the user has added "
 >kat" as a correct word..
40    var mPersonalDictionary = Components.classes["@mozilla.org/sp
 >ellchecker/personaldictionary;1"]
41                                .getService(Components.interfaces
 >.mozIPersonalDictionary);
42    if (mPersonalDictionary.check("kat", gSpellCheckEngine.dictio
 >nary))
43    {
44        // It's spelled correctly accourdly to user personal dict
 >ionary
45    }
46    else
47    {
34    // It's spelled incorrectly48        // It's spelled incorrectly
35}49    }
50}                                                       
n48   // suggestions.value is a JavaScript <a href="en/Core_JavaScrin63   // suggestions.value is a JavaScript <a href="/en/Core_JavaScr
>pt_1.5_Reference/Global_Objects/Array">Array</a> of strings>ipt_1.5_Reference/Global_Objects/Array" title="en/Core_JavaScript
 >_1.5_Reference/Global_Objects/Array">Array</a> of strings
tt66</pre>
67    <p>
51</pre>{{ languages( { "fr": "fr/Utilisation_du_correcteur_orthogr68      {{ languages( { "fr": "fr/Utilisation_du_correcteur_orthogr
>aphique_dans_XUL", "ja": "ja/Using_spell_checking_in_XUL" } ) }}>aphique_dans_XUL", "ja": "ja/Using_spell_checking_in_XUL" } ) }}
69    </p>

Back to History