SpellCheckAsYouType (SCAYT)

GrammarAsYouType (GRAYT) for CKEditor 4+

GrammarAsYouType (GRAYT) for CKEditor 4+ is a grammar check feature that allows users to see and correct grammar problems while typing. GRAYT is shipped together with SpellCheckAsYouType (SCAYT). Currently the GRAYT feature is available only in CKEditor 4 and later versions.

GRAYT uses the WebSpellChecker.net grammar engine. To learn more about the grammar engine’s capabilities as compared to MS Word, click here.

Note: Currently GRAYT supports only American and British English languages for checking in the dialog window.

Supported browsers: Internet Explorer 8+, Chrome latest version, Firefox latest version.

How to Use GRAYT for CKEditor 4+

  1. Enter the required text in the CKEditor. The text containing grammar mistakes is underlined in green, while the text containing spelling mistakes is underlined in red

    Note: Spelling mistakes take priority over grammar mistakes.

    The example contains both spelling and grammar mistakes in the same part of the sentence.

  2. Correct the spelling mistake. After a spelling correction is applied, the same phrase is underlined in green, which means it contains a grammar mistake
  3. Right-click the grammar mistake to open the GRAYT context menu.
  4. View the description of the mistake.
  5. Select a suggestion to replace the mistake, if available. Otherwise, paraphrase the mistake.

How to Enable/Disable GRAYT

To turn the GRAYT feature on or off, set the grayt_autoStartup parameter value to ‘true’ or ‘false’ respectively:

Study the sample code below for more technical information.

										<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
												"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
										<html xmlns="http://www.w3.org/1999/xhtml">
										<head>
											<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
											<script type="text/javascript" src="ckeditor/ckeditor_source.js"></script>
										</head>
										<body>
											<textarea id="editor1">
												This is an exampl of a sentence with two mispelled words.
												Just type text with misspelling to see how it works.
											</textarea>
											<script type="text/javascript">
												// For SCAYT Licensed version
												// CKEditor version higher than 4.4 or equal
												CKEDITOR.config.scayt_srcUrl = "http://spellcheck_host/spellcheck/lf/scayt3/ckscayt/ckscayt.js";
												// For SCAYT Licensed version
												// CKEditor version less than 4.4
												CKEDITOR.config.scayt_srcUrl = "http://spellcheck_host/spellcheck/lf/scayt/scayt.js";
												// For SCAYT Hosted version
												CKEDITOR.config.scayt_customerid = 'encrypted-customer-ID';
												// evaluate SCAYT on startup
												CKEDITOR.config.scayt_autoStartup = true;
												// evaluate GRAYT on startup
												CKEDITOR.config.grayt_autoStartup = true;
												// set up max suggestion count in context menu
												// all other words will be present in "More Suggestions" sub menu
												CKEDITOR.config.scayt_maxSuggestions = 4;
												// set up SCAYT default language
												CKEDITOR.config.scayt_sLang ="en_US";
												// set up User Dictionary
												CKEDITOR.config.scayt_userDictionaryName = "MyUserDictionaryName";
												// set up Custom Dictionary
												CKEDITOR.config.scayt_customDictionaryIds = "ID1, ID2";
												// enable/disable the "More Suggestions" sub-menu in the context menu.
												// The possible values are "on" or "off".
												CKEDITOR.config.scayt_moreSuggestions = 'off';
												// customize the display of SCAYT context menu commands ("Add Word", "Ignore"
												// and "Ignore All"). It must be a string with one or more of the following
												// words separated by a pipe ("|"):
												// "off": disables all options.
												// "all": enables all options.
												// "ignore": enables the "Ignore" option.
												// "ignoreall": enables the "Ignore All" option.
												// "add": enables the "Add Word" option.
												CKEDITOR.config.scayt_contextCommands = 'add|ignoreall';
												// set the visibility of the SCAYT tabs in the settings dialog and toolbar
												// button. The value must contain a "1" (enabled) or "0" (disabled) number for
												// each of the following entries, in this precise order, separated by a
												// comma (","): "Options", "Languages" and "Dictionary".
												CKEDITOR.config.scayt_uiTabs = '1,0,1';
												// Define order of placing of SCAYT context menu items by groups.
												// It must be a string with one or more of the following
												// words separated by a pipe ("|"):
												// 'suggest' - main suggestion word list
												// 'moresuggest' - more suggestions word list
												// 'control' - SCAYT commands, such as 'Ignore' and 'Add Word'
												CKEDITOR.config.scayt_contextMenuItemsOrder ='moresuggest|control|suggest';
												// Define minimum length of the words that will be collected from editor for spell-checking.
												// 'value' - any positive number
												CKEDITOR.config.scayt_minWordLength = 4;
												// Specify the names of tags that will be skipped while spell checking.
												CKEDITOR.config.scayt_elementsToIgnore = 'del,pre';
												// Disable SCAYT options storage in localStorage.
												// Possible values are:
												// "options" - disable all options storage, except "lang"
    											// "ignore-all-caps-words" - disable ignore-all-caps-words option storage
												// "ignore-domain-names" - disable ignore-domain-names option storage
												// "ignore-words-with-mixed-cases" - disable ignore-words-with-mixed-cases option storage
												// "ignore-words-with-numbers" - disable ignore-words-with-numbers option storage
												// "lang" - disable spellcheck language storage
												// "all" - disable storage of the all options
												CKEDITOR.config.scayt_disableOptionsStorage = ['lang', 'ignore-all-caps-words', 'ignore-words-with-mixed-cases']
												// enable/disable ignore-words-with-numbers option. Should be used in conjunction with scayt_disableOptionsStorage parameter  because optionStorage has higher priority then defined value by default.
												CKEDITOR.config.scayt_ignoreWordsWithNumbers = true;
												// enable/disable ignore-domain-names option. Should be used in conjunction with scayt_disableOptionsStorage parameter  because optionStorage has higher priority then defined value by default.
												CKEDITOR.config.scayt_ignoreDomainNames = true;
												// enable/disable ignore-words-with-mixed-cases option. Should be used in conjunction with scayt_disableOptionsStorage parameter  because optionStorage has higher priority then defined value by default.
												CKEDITOR.config.scayt_ignoreWordsWithMixedCases = true;
												// enable/disable ignore-all-caps-words option. Should be used in conjunction with scayt_disableOptionsStorage parameter  because optionStorage has higher priority then defined value by default.
												CKEDITOR.config.scayt_ignoreAllCapsWords = true;
												// The parameter turns on/off SCAYT initiation when Inline CKEditor is not focused.
												// SCAYT markup is taken place (SCAYT instance is not destroyed) in both Inline CKEditor's states, focused and unfocused.

												CKEDITOR.config.scayt_inlineModeImmediateMarkup = true;
												// launch CKeditor
												CKEDITOR.replace( 'editor1' );
											</script>
										</body>
										</html>