Spellcheck Extension for Arbitrary Web Pages

From CDOT Wiki
Jump to: navigation, search

Project Name

Spellcheck Extension for Arbitrary Web Pages

Project Description

Write an extension to leverage the existing spellcheck code in Mozilla and add the ability to highlight spelling mistakes for a given web page (i.e., vs. a textbox).

Project Leader

Aaron Hooper

Project Contributor(s)

Bart Barcicki

Project Details

0.1 Release - http://zenit.senecac.on.ca/wiki/index.php/Image:Spellcheck.xpi

Make an extension that have the menus for spell checking but not yet do anything.


Project News

  • 10/13/2008 - Got my first extension up an running
  • 09/23/2008 - Talked through email with Neil Deakin about the parts of code I will need probably need to modify

IRC log of conversation about this extension

  • 12:14 <@dave> how hard would it be to add Tools > Spell-Check?
  • 12:14 <@dave> i.e., for an arbitrary page vs. textbox
  • 12:14 < shaver> good question
  • 12:15 <@dave> or probably what I mean is Tools > Highlight Spelling Mistakes
  • 12:19 < shaver> you'd want a presentation like the findbar?
  • 12:19 <@dave> depends on use case, but that's one good one, yeah
  • 12:19 <@dave> I'm thinking of being able to just underline all mispelled words on the page
  • 12:23 < mfinkle> look into http://mxr.mozilla.org/seamonkey/source/editor/txtsvc/public/nsIInlineSpellChecker.idl
  • 12:23 < mfinkle> it is keyed to use an editor
  • 12:23 < mfinkle> but the code inside could be useful
  • 12:23 <@dave> I should talk to enn I guess
  • 12:24 < mfinkle> the red squiggle is done using a special kind of selection type
  • 12:25 <@dave> mfinkle: yeah, I've seen that code before.
  • 12:25 <@dave> the selection
  • 12:25 < mfinkle> http://mxr.mozilla.org/seamonkey/source/extensions/spellcheck/src/mozInlineSpellChecker.cpp
  • 12:25 <@dave> but this idl looks interesting
  • 12:25 < mfinkle> is an inline spellcheck implementation for editors
  • 12:26 < mfinkle> DoSpellCheck does some heavy lifting
    http://mxr.mozilla.org/seamonkey/source/extensions/spellcheck/src/mozInlineSpellChecker.cpp#1223
  • 12:27 < mfinkle> whoops, down a few lines
  • 12:28 <@dave> 1278 if (! editor)
  • 12:28 <@dave> 1279 return NS_ERROR_FAILURE;
  • 12:28 <@dave> hm
  • 12:28 < mfinkle> yeah, but it seems to use ranges, so swapping in a document shouldn't be impossible
  • 12:29 < mfinkle> and notice that mSpellCheck is an instance of the real spellcheck engine
  • 12:29 <@dave> yeah
  • 12:29 <@dave> I'm trying to find uses of editor, and it's thin
  • 12:31 < mfinkle> well mSpellCheck is a nsIEditorSpellCheck
  • 12:31 < mfinkle> must go deeper
  • 12:33 < mfinkle> crap, nsISpellCheck is not public - wtf
  • 12:33 <@dave> weird
  • 12:33 < shaver> fixable, I bet
  • 12:34 < mfinkle> I suppose building directly against the tree (instead of the sdk) is doable
  • 12:34 <@dave> so this is a tree exercise vs. an ext
  • 12:34 < mfinkle> kinda like vlad's canvas3d
  • 12:34 < mfinkle> right
  • 12:34 < shaver> no, it's an extension
  • 12:34 < mfinkle> well, it can be an extension
  • 12:34 < shaver> it's just not one that can use only frozen APIs
  • 12:34 < mfinkle> but it needs the tree
  • 12:34 < shaver> like basically any useful extension
  • 12:34 <@dave> :)
  • 12:34 < mfinkle> sadly
  • 12:35 < mfinkle> but anyway - onward
  • 12:35 <@dave> I think I'll take some notes here and craft a project for future
  • 12:35 < mfinkle> http://mxr.mozilla.org/seamonkey/source/extensions/spellcheck/src/mozSpellChecker.cpp
  • 12:35 < mfinkle> implements the nsISpellCheck interface
  • 12:36 < mfinkle> takes an nsITextServicesDocument
  • 12:36 <@dave> how generic is that?
  • 12:38 < mfinkle> can be initialized with a document! http://mxr.mozilla.org/seamonkey/source/editor/txtsvc/src/nsTextServicesDocument.cpp#175
  • 12:38 < mfinkle> promising

Relevant Links