Initialization options
WProofreader can be initialized in several ways depending on your integration scenario. This page explains the supported methods and shows how to apply them in practice.
The WEBSPELLCHECKER_CONFIG (referred to as CONFIG) can be defined in a script or loaded from a file as described in the SDK overview.
👉 See demos for working examples with different editors and HTML elements.
Initialize using autoSearch
The autoSearch feature detects new editable fields on the page and enables proofreading when the field is focused.
Useful for pages with multiple controls.
Improves performance by checking only the active field.
Frees memory when fields are removed or hidden, preventing leaks.
Proofreading starts only when a field receives focus.
Example: using CONFIG
<script>
window.WEBSPELLCHECKER_CONFIG = {
autoSearch: true,
lang: 'en_US',
...
};
</script>Example: using inline data attributes
Inline data attributes don’t support some options (for example, actionItems, suggestionsCount, moreSuggestionsCount). Use CONFIG for full configuration.
Initialize using init() method
Use init() when you want explicit control over where WProofreader is enabled.
Suitable for static pages where controls are known in advance.
Instances are created on page load.
With dynamic content, you must manage when to create or destroy instances.
Proofreading is enabled immediately. It doesn’t require focus or selection, unlike with
autoSearch.
Example: single HTML element
Example: multiple elements
For multiple fields (such as a div and a textarea), define CONFIG once and call init() for each target element.
👉 See the demo for HTML controls.
Example: rich text editors
For editors such as CKEditor 4, Froala, or Quill, initialization usually combines autoSearch, autoDestroy, and init():
init()ensures WProofreader is explicitly attached to the editor’s editable container.autoSearchrestores the instance dynamically (for example, when switching between editing modes).autoDestroyremoves the instance when the editable container is deleted or hidden, preventing memory leaks.
This combination is useful when switching between editing modes (for example, toggling between WYSIWYG and code view). In such cases, WProofreader must be destroyed in one mode and restored automatically when the user switches back.
👉 See the demo with CKEditor 4, Froala, or Quill.
Initialize using data-wsc-autocreate
Mark elements with data-wsc-autocreate="true" to create instances automatically. Element-level attributes can override global CONFIG settings.
Example: HTML elements
Related resources
Configuration reference — full list of available options.
JavaScript SDK on npm and GitHub repository — includes framework examples with CKEditor 4, TinyMCE, Froala, and Quill in Vue, React, and Angular.
Was this helpful?

