Changes

Jump to: navigation, search

Spellcheck Extension for Arbitrary Web Pages

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

Navigation menu