Represent WEBSPELLCHECKER initialization and configuration options.
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options.container |
string | Node | a DOM node with text or its selector. |
||
options.autoStartup |
boolean |
<optional> |
true | Turn on/off a WEBSPELLCHECKER instance autostartup. If 'true', it turns on WEBSPELLCHECKER automatically after the application is loaded. |
options.autoDestroy |
boolean |
<optional> |
false | Turn on/off the auto-destroy functionality of a WEBSPELLCHECKER instance. By default, it is enabled for WProofreader that is initialized using 'autoSearch'. It can be used to avoid monitoring the state of the instance and handling its destruction after removal of an editable container from the page. |
options.disableProblemDescription |
boolean |
<optional> |
false | Disable grammar problem descriptions. If 'true' the problem description will not be shown on the suggestion pop-up and in Proofreader dialog. |
options.enableGrammar |
boolean |
<optional> |
true | Turn grammar checking option on the startup. |
options.actionItems |
array |
<optional> |
['addWord', 'ignoreAll', 'settings', 'toggle', 'proofreadDialog'] | Define the presence and order of the action items inside of their sections (suggestion pop-pup, badge, proofread dialog). of menu items inside of their sections. |
options.lang |
string |
<optional> |
'auto' | Set the default language for text checking for available types of problems. The possible values are: 'en_US', 'en_GB', 'pt_BR', 'da_DK', 'nl_NL', 'en_CA', 'fi_FI', 'fr_FR', 'fr_CA', 'de_DE', 'el_GR', 'it_IT', 'nb_NO', 'pt_PT', 'es_ES', 'sv_SE', 'uk_UA', 'auto' |
options.autoLangPriorities |
object |
<optional> |
{} | Define language dialect priorities if the language auto-detection (auto) is enabled. E.g. when auto defines 'en', it will either use a predefined dialect or use the one specified in this option. |
options.suggestionsCount |
number |
<optional> |
3 | Define a number of suggestions to be shown in the suggestion pop-up for a problem correction. |
options.moreSuggestionsCount |
number |
<optional> |
0 | Define a number of the suggestions to be shown on the 'More Suggestions' sub-section of the suggestion pop-up element. If '0', the 'More Suggestions' sub-section won’t be displayed. |
options.serviceProtocol |
string |
<optional> |
'http' | A protocol which is used to access the service. |
options.serviceHost |
string |
<optional> |
'svc.webspellchecker.net' | A host name of the service. |
options.servicePort |
number |
<optional> |
'80' | A default port of the service. |
options.servicePath |
string |
<optional> |
'spellcheck31/script/ssrv.cgi' | A path to the service. |
options.minWordLength |
number |
<optional> |
3 | Define the minimum number of letters in a word that will be collected from text for spell checking. The possible value is any positive number. |
options.customDictionaryIds |
string |
<optional> |
'' | Global custom dictionary ID(s)separated by commas (',') which will be used during spelling check. Further details can be found at link. |
options.userDictionaryName |
string |
<optional> |
'' | A user dictionary name which will be used during spell checking. |
options.settingsSections |
array |
<optional> |
['dictionaries', 'languages', 'options'] | Manage presence of the settings sections in the dialog. Please note that the "About" section is not allowed to be removed by default. Such a customization available for holders of the Server version and the Custom plan of the Cloud version. For more details, please contact support@webspellchecker.net. |
options.serviceId |
string |
<optional> |
'' | A special service ID value (activation key) that is used for the service activation. It is received on the subscription to the trial or paid services. |
options.localization |
string |
<optional> |
'en' | A language used for the interface localization. If the detectLocalizationLanguage parameter is enabled, it will be detected automatically from browser settings. If no parameter is specified or the localization can't be automatically detected, a default value will be used. Possible values are: 'af', 'ar', 'bg', 'bn', 'bs', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en-au', 'en-ca', 'en-gb', 'en-us', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr-ca', 'fr', 'gl', 'gu', 'he', 'hi', 'hr', 'hu', 'is', 'it', 'ja', 'ka', 'km', 'ko', 'ku', 'lb', 'lt', 'lv', 'mk', 'mn', 'ms', 'nb', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sr-latn', 'sr', 'sv', 'th', 'tr', 'ug', 'uk', 'vi', 'zh-cn', 'zh' |
options.detectLocalizationLanguage |
boolean |
<optional> |
false | Set auto localization detection. Localization will be detected automatically from browser settings. If the localization can't be automatically detected, a localization parameter or default value will be used. |
options.ignoreElements |
string |
<optional> |
'a|pre|code|style|script' | The names of HTML tags separated by '|' symbol which will be skipped by text checking. |
options.ignoreClasses |
string |
<optional> |
[] | The CSS classes which will be skipped by text checking. |
options.ignoreAttributes |
string |
<optional> |
[] | The CSS attributes which will be skipped by text checking. |
options.ignoreAllCapsWords |
boolean |
<optional> |
false | Ignore capitalized words during check. You may need to disable the options storing in the browser storage using the 'options.disableOptionsStorage' as it has higher priority. |
options.ignoreDomainNames |
boolean |
<optional> |
true | Ignore domain names during check. You may need to disable the options storing in the browser storage using the 'options.disableOptionsStorage' as it has higher priority. |
options.ignoreWordsWithMixedCases |
boolean |
<optional> |
false | Ignore words written with mixed case letters during check. You may need to disable the options storing in the browser storage using the 'options.disableOptionsStorage' as it has higher priority. |
options.ignoreWordsWithNumbers |
boolean |
<optional> |
true | Ignore words containing numbers during check. You may need to disable the options storing in the browser storage using the 'options.disableOptionsStorage' as it has higher priority. |
options.enableBadgeButton |
boolean |
<optional> |
true | Manage the visibility of the badge element. If 'false', all the action items from the badge will be moved to the suggestion pop-up. |
options.enableLanguagesInBadgeButton |
boolean |
<optional> |
false | Manage the visibility of the languages selector for text checking from the badge element. |
options.disableOptionsStorage |
array |
<optional> |
[] | Disable storing of WEBSPELLCHECKER options such as ignore options and language between browser sessions. If enabled, the user-selected options will be reset after page reload. The 'autoSearch' functionality by default is set to reset all settings. The following settings can be used:
|
options.ecVersion |
number |
<optional> |
2 | The version of the application for HTML editable controls. The default value is '2'. Value '1' stands for enabling the old version of the application which is kept for the backward compatibility and exception case (like old versions of IE browser). |
options.undoDataSize |
number |
<optional> |
20 | The length of the Undo array. It can be applied and used only with the old version of the application for HTML editable controls (if 'ecVersion = 1'). |
options.disableDictionariesPreferences |
boolean |
<optional> |
false | Manage the visibility of the dictionaries preferences section on the Dictionaries tab for end users. If 'false', the users won’t have an option to create, connect, delete or rename a user dictionary. |
options.removeBranding |
boolean |
<optional> |
false | Remove branding information that is present on WProofreader UI such as the product title, the About tab with logo and copyrights. Note: This option is available only for certain types of pricing plans. |
options.disableBadgePulsing |
boolean |
<optional> |
false | Disable the pulsing effect for the badge element. |
options.requestTokensCount |
number |
<optional> |
10 | The maximum number of tokens (sentences) to check per request. |
options.disableDialog |
boolean |
<optional> |
false | Turn on/off the 'proofread in dialog' mode. |
options.theme |
string |
<optional> |
'default' | Set the style of UI. The possible values are: 'default', 'custom', 'gray', 'ckeditor5', 'dark'. You have an option to define your custom CSS styles, use 'custom' theme value. |
options.disabledRules |
array |
<optional> |
[] | Provide an array of grammar rules IDs to be disabled for all users. |
options.restoreNativeSpellCheck |
boolean |
<optional> |
false | Restore native browser spell check mechanism when WProofreader in disabled mode. |
options.syncOptions |
boolean |
<optional> |
true | Synchronize all ignore options and language between all created WProofreader instances. |
options.globalProofreadDialog |
boolean |
<optional> |
true | Aggregate all suggestions in one Proofread Dialog. |
options.onLoad |
function | This callback function is triggered by the application when it is ready to use. |
||
options.onCommitOptions |
function | This callback function is triggered by any change made to the following options: 'lang', 'ignoreAllCapsWords', 'ignoreDomainNames', 'ignoreWordsWithMixedCases', 'ignoreWordsWithNumbers'. |
||
options.onAddWordToUserDictionary |
function | This callback function is triggered by addition of each new word to a personal user dictionary. |
||
options.onDeleteWordFromUserDictionary |
function | This callback function is triggered by deletion of any word from a personal user dictionary. |
||
options.onStatistics |
function | This callback function is triggered by every statistics action such as: replace word, ignore all, add a word to dictionary, delete a word from dictionary. |
||
options.onErrorRequest |
function | This callback function is triggered by every request that ended with error. |
||
options.onToggle |
function | This callback function is triggered by every toggle application event. |
Example
var instance = WEBSPELLCHECKER.init({
container: document.getElementById('elementId'),
autoStartup: true,
lang: 'de_DE',
autoLangPriorities: {
en: 'en_AI',
de: 'de_DE'
},
localization: 'de',
actionItems: ['addWord', 'ignoreAll', 'ignore', 'settings', 'toggle', 'proofreadDialog'],
serviceProtocol: 'http',
servicePort: '80',
serviceHost: document.location.host,
servicePath: 'spellcheck/script/ssrv.cgi',
ignoreAllCapsWords: true,
ignoreDomainNames: false,
ignoreWordsWithMixedCases: true,
ignoreWordsWithNumbers: true,
disableOptionsStorage: ['lang', 'ignoreDomainNames'],
undoDataSize: 10,
disabledRules: ['UPPERCASE_SENTENCE_START'],
ignoreClasses: ['wsc-ignore-checking', 'skip-me'],
ignoreAttributes: ['data-wsc-ignore-checking', 'data-skip-me'],
onLoad: function(instance) {
// 'this' refers to WEBSPELLCHECKER instance
// instance - a WEBSPELLCHECKER instance.
this.setDisabled(true);
},
onCommitOptions: function(changedOptions, instance) {
// changedOptions - options changed after the onCommitOptions event.
// instance - a WEBSPELLCHECKER instance.
}
onAddWordToUserDictionary: function(word, instance) {
// word - a word added to the dictionary.
// instance - a WEBSPELLCHECKER instance.
},
onDeleteWordFromUserDictionary: function(word, instance) {
// word - a word deleted from the dictionary.
// instance - a WEBSPELLCHECKER instance.
},
onStatistics: function(data, instance) {
// data - an object with statistics data.
// data.action - type of the action (replace, ignore, add, delete).
// data.text - a text of the action (replaced phrase, ignored phrase, added or removed from the User Dictionary word).
// data.newText - a new text (for the replace action only).
// data.lang - a language of the problem from the action.
// data.type - a type of the problem (spelling, grammar e.t.c).
// data.category - a category of the problem (if problem has the category).
// data.rule - a rule of the problem (if problem has the rule).
// data.context - a context where action was applied.
// data.offset - an offset to the problem in the context.
// instance - a WEBSPELLCHECKER instance.
},
onErrorRequest: function(data, instance) {
// data - an object with information about an error.
// instance - a WEBSPELLCHECKER instance.
},
onToggle: function(instance) {
// instance - a WEBSPELLCHECKER instance.
// instance.isDisabled() - use this API method to check if the application is in disabled or enabled state.
}
});