WebSpellChecker

WebSpellChecker for Hidden Control Based WYSIWYG

Installation Guide

1. Download and install Sproxy.

2. Specify WSC URI (See sample, line 6).

3. Define the WSC invoker:

doSpell({ctrl:sMyEditor, lang:sInitialLanguage, onClose:onCloseHandler, onCancel:onCancelHandler,onFinish:onFinishHandler}), where:

sMyEditor {String,mandatory} — Iframe instance identifier.
sInitialLanguage {String,mandatory} — initial spell check language name. Now supported: en, dk, uk, nl, fr, no, el, ge, pt, it, sp, br, se.
onCloseHandler {Function,optional} — Callback function reference.
onCancelHandler {Function,optional} — Callback function reference.
onFinishHandler {Function,optional} — Callback function reference.

Before opening WSC, copy the editor content to the hidden control element. See sample, lines 11-23.

4. Copy the content from the hidden control to your WYSIWYG editor after you've finished checking the content. See sample, lines 27-30).

5. Invoke WSC when you want to check the spelling (see sample, line 46).

Sample

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>WebSpellChecker for hidden control based WYSIWYG</title>
  6. <script type="text/javascript" src="editors/FCKeditor/fckeditor.js"></script>
  7. <script type="text/javascript" src="/sproxy2/sproxy.cgi?cmd=script&doc=wsc"></script>
  8. <script type="text/javascript">
  9. //<!--
  10. function getControls(sId){
  11. return {frame: document.getElementById(sId + "___Frame"), input: document.getElementById(sId)}
  12. }
  13. function startSpellCheck(){
  14. var oEditorControls = getControls('myEditor');
  15. oEditorControls.input.value = oEditorControls.frame.contentWindow.FCK.GetXHTML();
  16. doSpell({
  17. ctrl:'myEditor',
  18. lang:'en',
  19. onClose:onClose,
  20. onCancel:onCancel,
  21. onFinish:onFinish
  22. });
  23. }
  24. onClose = function(mSender){}
  25. onCancel = function(mSender){}
  26. onFinish = function(mSender){
  27. var nEditorControl = getControls(mSender.id);
  28. nEditorControl.frame.contentWindow.FCK.SetHTML (nEditorControl.input.value);
  29. }
  30. //-->
  31. </script>
  32. </head>
  33. <body>
  34. <script type="text/javascript">
  35. //<!--
  36. var oFCKeditor = new FCKeditor( 'myEditor' ) ;
  37. oFCKeditor.BasePath = "editors/FCKeditor/";
  38. oFCKeditor.Height = 300 ;
  39. oFCKeditor.Width = 700 ;
  40. oFCKeditor.Value = 'This is an exampl of a sentence with two mispelled words.' ;
  41. oFCKeditor.Create();
  42. //-->
  43. </script>
  44. <input type="button" value="Spell Check" onclick="startSpellCheck()"/>
  45. </body>
  46. </html>

SpellCheckAsYouType