2010-08-24 89 views
0

我要寻找一个Firefox扩展的解决方案,以拦截Firefox的字典行动:Firefox扩展插件拦截字典行动“加字字典”

当用户选择的动作“加字字典”我要修改在将其插入用户的向下词典文件persdict.dat之前的单词。

这可能吗?如何做呢? 在为这个特殊用例编写我自己的扩展时,有什么特别的东西需要照顾?

回答

0

我找到了自己的问题的答案。覆盖firefox spellchecker的InlineSpellCheckerUI.addToDictionary功能完成了这项工作。这是我的扩展名为xul的文件:

<?xml version="1.0"?> 

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

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

</overlay>