AutoSearchMechanism

AutoSearchMechanism

Represents a WEBSPELLCHECKER auto search mechanism.

Properties:
Name Type Attributes Default Description
WEBSPELLCHECKER_CONFIG.autoSearch Boolean <optional>
false

The parameter turns on the autoSearch mechanism that automatically detects editable fields on the page and on focus enables proofreading in them.

WEBSPELLCHECKER_CONFIG.disableAutoSearchIn Array <optional>
['input']

The parameter allows disabling the autoSearch mechanism by class, id, data attribute name and HTML elements. If enableAutoserchIn option is specified than this option will be ignored. Possible values are: '.class' - disable autoSearch for elements with a specified class. '#id' - disable autoSearch for elements with a specified id. '[data-attribute]' - disable autoSearch for elements with a specified data attribute name. 'textarea' - disable autoSearch for HTML elements (e.g. textarea, input).

WEBSPELLCHECKER_CONFIG.enableAutoSearchIn Array <optional>
[]

The parameter allows enabling the autoSearch mechanism only for elements with provided class, id, data attribute name or HTML elements type. Possible values are: '.class' - enable autoSearch for elements with a specified class. '#id' - enable autoSearch for elements with a specified id. '[data-attribute]' - enable autoSearch for elements with a specified data attribute name. 'textarea' - enable autoSearch for HTML elements (e.g. textarea, input).

WEBSPELLCHECKER_CONFIG.ignoreSpellcheckAttribute Boolean <optional>
false

The parameter allows to ignore native spellcheck attribute with false value.

Examples

<script>
    window.WEBSPELLCHECKER_CONFIG = {
        autoSearch: true,
        disableAutoSearchIn: ['.class', '#id', '[data-attribute]', 'textarea'], // will be ignored if enableAutoSearchIn option is specified
        enableAutoSearchIn: ['.class', '#id', '[data-attribute]', 'textarea'],
        ignoreSpellcheckAttribute: true,
        serviceId: "Your current service ID",
        serviceProtocol: 'https',
        serviceHost: 'svc.webspellchecker.net',
        servicePath: 'spellcheck31/script/ssrv.cgi',
        servicePort: '443',
        lang: 'en_US'
    }
</script>

<script src="https://svc.webspellchecker.net/spellcheck31/wscbundle/wscbundle.js"></script>
// For simple ignoring elements use `data-wsc="false"` attribute.
// Next `div` element will be ignored by WProofreader.

<div contenteditable="true" data-wsc="false">
    Sample text.
</div>