Spell Checking for CKEditor - With No Adverts!

Spellchecking CKEditor


Javascript Spell Check provides allows you to spell-check CKEditor using the $Spelling.SpellCheckInWindow function.


To Spell-check every CKEditor instance on the page:

$Spelling.SpellCheckInWindow('editors')


To Spell-check one CKEditor instance

To selectively target a rich editor - you cannot pass the Id of the textarea it replaces - as most editors are unaware of changes to the fields that they override.

How to do it properly...


$Spelling.SpellCheckInWindow('cke_1_contents') // or cke_2_contents....


<script src="http://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.0.1/ckeditor.js"></script>
<script>
CKEDITOR.replace( 'myTextArea' );
</script>
 
<input type="button" value="Spell Check" onclick="$Spelling.SpellCheckInWindow('editors')" />

Installation

Getting started with JavaScript spell check is very simple.

  • Download JavaScriptSpellCheck.zip
  • Unzip the package
  • Copy the " JavaScriptSpellCheck" folder to the root folder of your website; its URL should be "/JavaScriptSpellCheck"
  • Note: If you are using an ASP.Net server - copy ASPNetSpell.dll to the "/bin/ASPNetSpell.dll"
  • Open "/ JavaScriptSpellCheck/02-TestInstall.html" in your browser to test the installation.
  • Copy the source code form this example into one of your own web pages.

Primary Functions

Function Description Example
$Spelling.SpellCheckInWindow(Fields) Opens a spellchecking dialog window Live Demo With Source Code...
$Spelling.SpellCheckAsYouType(Fields) Causes any texarea(s) to underline any misspelled words - and provides spelling suggestions on right click. Live Demo With Source Code...
$Spelling.LiveValidation(Field,MessageElementId) Shows a warning message beside Field when it contains spelling errors. Live Demo With Source Code...


Real-Time Spell Checking Functions

Function Description Example
$Spelling.BinSpellCheck(input) Returns bool:
  • True if input is in the dictionary
  • False if it is not.
Live Demo With Source Code...
$Spelling.BinSpellCheckFields(Fields) Spell checks one or more fields in your page - and returns bool:
  • True if all fields are spelled correctly
  • False if the fields contain spelling errors.
Live Demo With Source Code...
$Spelling.SpellCheckSuggest(input) Returns an array of spelling suggestions for input. Live Demo With Source Code...
$Spelling.ListDictionaries() Returns an array of currently installed dictionaries in your JavaScriptSpellCheck/dictionaries folder. Live Demo With Source Code...

AJAX Spell checking Functions

Function Description Example
o = $Spelling.AjaxSpellCheck(input);

o.onSpellCheck = function(result,suggestions){}

Spellchecks a word and asynchronously returns a boolean spellchecking result and suggestions. Live Demo With Source Code...
o = $Spelling.AjaxSpellCheckFields(Fields)

o.onValidate = function(result){}

Spell checks one or more fields in your page - and returns asynchronously a boolean spellchecking result. Live Demo With Source Code...
o = $Spelling.AjaxDidYouMean(string)

o.onDidYouMean = function(result){}

Asynchronously returns an suggestions string for a search box spellchecking phrase. Live Demo With Source Code...

Properties

Property Type Default Value Description
$Spelling.DefaultDictionary string "English (International)" The dictionary language used by JavaSript SpellCheck.
$Spelling.UserInterfaceTranslation string "en" Translates the context menu and spellchecker dialog into over 50 international languages.
  • See our translations page for a full list of language locale codes.
$Spelling.ShowStatisticsScreen bool false Shows a statistics screen (word count, edit count) after SpellCheckInWindow.
$Spelling.SubmitFormById string "" Will submit a form (identified by its id attribute) once spellchecking once SpellCheckInWindow is complete.
$Spelling.Theme string "js.modern" Allows you to apply a CSS theme to change the appearance of JavaScript SpellCheck.
  • Corresponds to theme folder in /JavaScriptSpellCheck/themes
$Spelling.CaseSensitive bool true Spellchecker notices cAse mIstAkes
$Spelling.IgnoreAllCaps bool true Spellchecker ignores BLOCK CAPITAL letters which are often acronyms.
$Spelling.CheckGrammar bool true Spellchecker notices basic grammar mistakes such as sentence casing and repeated words.
$Spelling.IgnoreNumbers bool true Spellchecker ignores words with numbers in them like "High5" or "MSO7262BGO"
$Spelling.ShowThesaurus bool true Spellchecker shows a thesaurus and look-up-meaning link during SpellCheckInWindow
$Spelling.ShowLanguagesInContextMenu bool false Allows the user to pick a dictionary Language from all installed dictionaries during SpellCheckAsYouType
$Spelling.ServerModel string "auto" Allows you to pick which server model JavaScriptSpellCheck will use for its AJAX requests. Values available are:
  • 'php' - PHP
  • 'asp' - classic ASP
  • 'asp.net' - ASP.net 2 or above raw request handler
  • 'aspx' - ASP.net 2 or above ASPX page
  • 'auto' automatically detects the best choice in the vast majority of cases.
$Spelling.PopUpStyle




string "modal" SpellCheckInWindow pop-up style:
  • "modal" - a modal dialog window
  • "modeless" - a modeless dialog window
  • "popup" - a normal popup
  • "modalbox" - prototype style JavaScript modal pop-up.
  • "fancybox" - jquery style JavaScript modal pop-up.

See the custom PopUps And Themes Tutorial.


Events

Event Description Example
onDialogOpen() SpellCheckInWindow dialog pops up. $Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onDialogOpen = function(){}

onDialogComplete() SpellCheckInWindow dialog completes successfully - user has not quit $Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onDialogComplete = function(){}

onDialogCancel() SpellCheckInWindow dialog completes is quite by the user $Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onDialogCancel = function(){}

onDialogClose() SpellCheckInWindow dialog closes for any reason $Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onDialogClose = function(){}

onChangeLanguage(language) SpellCheckInWindow or SpellAsYouType language is changed by the user.
  • Language name is passed as a string
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onChangeLanguage = function(language){}

onIgnore(word) A word is ignored by the user in wither SpellCheckInWindow or SpellAsYouType.
  • Word is passed as a string
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onIgnore = function(word){}

onIgnoreAll(word) The user clieck 'Ignore All' for a word in either SpellCheckInWindow or SpellAsYouType.
  • Word is passed as a string
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onIgnoreAll = function(word){}

onChangeWord(from,to) The user changes a word in either SpellCheckInWindow or SpellAsYouType.
  • "from" and "to" are passed as strings
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onChangeWord = function(from,to){}

onChangeAll(from,to) The user clicks 'Change All' for a word in SpellCheckInWindow.
  • "from" and "to" are passed as strings
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onChangeAll = function(from,to){}

onLearnWord(word) The user "Adds to Dictionary" in either SpellCheckInWindow or SpellAsYouType.
  • Word is passed as a string
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onLearnWord = function(word){}

onLearnAutoCorrect(from,to) The user adds to autocorrect in SpellCheckInWindow.
  • "from" and "to" are passed as strings
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onLearnAutoCorrect = function(from,to){}

onUpdateFields(arrFields) Any field is updated due to spellchecing.
  • arrFields is returned - an array of the Ids of all updated fields.
$Spelling.PopUpStyle="modeless";

o = $Spelling.SpellCheckInWindow('all');
o.onUpdateFields = function(arrFields){}



jQuery Functions & Options

JavaScriptSpellCheck also provides a jQuery SpellCheck Plugin

jQuery Functions


Function Return Value Description
$('#mySelction').spellCheckInDialog(options) Opens a spellchecking dialog window Spelling Instance Object
  • #mySelction can be any jQuery selection of elements
$('#mySelction').spellAsYouType(options) Spelling Instance Object Causes any texarea(s) selected to underline any misspelled words - and provides spelling suggestions on right click.
  • #mySelction can be any jQuery selection of elements
$('#mySelction').binSpellCheckFields(options) *True if all fields are spelled correctly
  • False if the fields contain spelling errors.
Spell checks all field in the selection.
  • #mySelction can be any jQuery selection of elements


jQuery Options


Option Default Value Description
defaultDictionary "English (International)" Default dictionary the spell checker will use.
userInterfaceTranslation "en" Translates the spellchecker dialog into over 50 international languages automatically.
showStatisticsScreen true Shows statistics such as word count and number of edits after spellCheckInDialog is complete.
submitFormById "" javascript id of a form to submit after spellCheckInDialog is complete.
theme "modern" CSS theme to apply to the spellchecker.
  • Relates to a folder in "JavaScriptSpellCheck/themes"
  • Learn more...
caseSensitive true Catches spelling mistakes caused by iNcoorect CasIng.
checkGrammar true Catches basic grammar mistakes such as repeated words, sentence casing and punctuation
ignoreAllCaps true Ignores BLOCK CAPS which are often abbreviations or product codes.
ignoreNumbers true Ignores w0rds w1th num8rs in them which are often product codes.
showThesaurus true Shows a thesaurus and word meaning lookup during spellCheckInDialog
showLanguagesInContextMenu true Allows the user to change dictionary 'on the fly' when using spellAsYouType
serverModel "auto" Chooses the server model that does the 'behind the scenes' AJX spellchecking requests. We support:
  • 'php' - PHP or above
  • 'asp' - classic ASP
  • 'asp.net' - ASP.net 2 or above raw request handler
  • 'aspx' - ASP.net 2 or above ASPX page
  • 'auto' automatically detects the best choice in the vast majority of cases.
popUpStyle "auto" spellCheckInDialog pop-up style:
  • "modal" - a modal dialog window
  • "modeless" - a modeless dialog window
  • "popup" - a normal popup
  • "modalbox" - prototype style JavaScript modal pop-up.
  • "fancybox" - jQuery JavaScript modal pop-up.

See the customPopUps And Themes Tutorial.

Download the Spell Checker Plugin »

CKEditor Spell Checking with JavaScript SpellCheck

CKEditor (also known as CKE) is probably the worlds most popular web based HTML editor or WYSIWYG. It allows users to edit rich content in their browser in much the same way they might use MS Word - visually producing HTML code from user input.

CKEditor’s build in spellchecker is implemented by spellchecker.net. This is an amazing free service - but it has 3 major drawbacks for developers:

Advertising: The spellchecker.net spellchecking solution which ships with CKEditor puts advertising popups all over you screen. The adverts are there to ‘fund’ the spell-checking web-service but are not really appropriate for any business, intranet, extranet or serious website application.

Security: The spellchecking is processed off-server - meaning that every single document edited using CKEditor using the default spellchecker is sent off site (out of your intranet) to a 3rd party server. This is clearly not ideal for high security applications such as Intranets or Extranets.

Cost: Those annoying adverts can be removed - but there is a price tag. That price (last we checked) was $3000 per year per server. This could amount to tens of thousands of dollars a year for a large scale website or intranet.

JavaScriptSpellCheck provides an easy to use, cross platform spell check solution for CKeditor with none of the above issues. If you have never used JavaScript Spellcheck before, it is the industry leading spellchecker solution websites and secure intranets.

JavaScriptSpellCheck has been developers to work with CKEditor in such as way that there are no adverts, no data sent off your server and no unreasonable annual fees.

Alternatave spellcheck plugins for ckeditor include the nanospell ckeditor spellchecking plugin.

Integrating JavaScriptSpellcheck to spellcheck your CKEditor instances should take about 5 minutes, and could improve usability and security of any website, intranet or extranet.

Also see our other spellchecking plugins for CKEditor, TinyMCE Editor, ASP.Net, Classic ASP, jQuery & PHP