views:

22

answers:

1

I am looking for a firefox extension solution to intercept a firefox dictionary action:

When a user chooses the action "add word to dictionary" i want to modify that word before it gets inserted into the user's down dictionary file persdict.dat .

Is this possible? And how can it be done? Is there anything special i need to take care of when writing my own extension for this special use-case ?

A: 

I found an answer to my own question. Overwriting the InlineSpellCheckerUI.addToDictionary function of the firefox spellchecker did the job. Here is my xul file of my extension:

<?xml version="1.0"?>

<overlay id="spellcheck-dehyphenation" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"&gt;

    <script type="text/javascript">
        InlineSpellCheckerUI.addToDictionary = function()
        {
                 this.mMisspelling = this.mMisspelling.replace(/\u00ad/g,'');
                 this.mInlineSpellChecker.addWordToDictionary(this.mMisspelling);
        };
    </script>

</overlay>
Thariama