Options

Options

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>
'en_US'

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.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>
['options', 'languages', 'dictionaries']

Manage presence and order 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 @BRANDING_SUPPORT_MAIL@.

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 no parameter is specified, it will be detected automatically from browser settings. If the parameter can't be automatically detected, a default value will be used. The 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', '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.ignoreElements string <optional>
'a|pre|code|style|script'

The names of HTML tags separated by '|' symbol 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>
false

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.proofreadAsYouType boolean <optional>
true

Turn on/off 'proofread as you type' mode. If 'false', only 'proofread in dialog' mode will be available.

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' – Disable storing of all ignore options, except 'lang'.
  • 'ignoreAllCapsWords' – Disable storing of the "Ignore All-Caps Words" option.
  • 'ignoreDomainNames' – Disable storing of the "Ignore Domain Names" option.
  • 'ignoreWordsWithMixedCases' – Disable storing of the "Ignore Words with Mixed Case" option.
  • 'ignoreWordsWithNumbers' – Disable storing of the "Ignore Words with Numbers" option.
  • 'lang' – Disable storing of the language used for check.
  • 'all' – Disable storing of all options.
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'. You have an option to define your custom CSS styles, use 'custom' theme value.

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.

Example

var instance = WEBSPELLCHECKER.init({
    container: document.getElementById('elementId'),
    autoStartup: true,
    lang: 'de_DE',
    localization: 'de',
    actionItems: ['ignoreall', 'addword', 'settings', 'toggle'],
    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
    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.
    }
});