Spelling Autocorrect plugin

This plugin is only available for paid TinyMCE subscriptions.
This feature is only available for TinyMCE 6.2 and later.

The Spelling Autocorrect plugin allows TinyMCE to autocorrect a specified set of spelling errors, common typos, and capitalization errors, as they are being typed.

Interactive Example

  • TinyMCE

  • HTML

  • JS

  • Edit on CodePen

<div id="tiny-ui">
  <textarea id="autocorrect" style="width: 100%; height: 500px;">
    <h2>Welcome to Spelling Autocorrect.</h2>
    <p>Please try this demo of the Spelling Autocorrect premium plugin.</p>
    <ol>
    <li>Deliberately mistype a word. For example, type <em>teh</em> instead of <em>the</em>.</li>
    <li>Begin a new sentence without capitalizing the initial word in the sentence.</li>
    </ol>
  </textarea>
</div>
tinymce.init({
  selector: 'textarea#autocorrect',
  plugins: 'autocorrect',
  autocorrect_capitalize: true
});

Basic setup

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'autocorrect'
});

Usage notes

The Spelling Autocorrect plugin currently has the following limitations:

  1. English is the only supported language.

  2. Capitalization and autocorrect can both be turned off, but specific autocorrections cannot.

    Spelling Autocorrect can be entirely turned off, but there is, currently, no way of instructing the plugin to ignore a particular string that it considers a mis-spelling.

    For example, if cna (which the Spelling Autocorrect plugin treats as a mis-typing of can) is a desired string in a particular use-case, turning the Spelling Autocorrect plugin off is currently recommended.

  3. Autocorrect and capitalization are not available as toolbar buttons. They are only available as menu items.

  4. Spelling Autocorrect is case-sensitive.

    As a consequence, mis-spelled words are not autocorrected if they do not exactly match the plugin’s built-in correction set.

    For example, Spelling Autocorrect autocorrects teh to the, but does not, currently, autocorrect Teh to The.

Known issues

The Spelling Autocorrect plugin has the following known issues:

  1. Autocorrect over-rides auto-capitalization.

    As a consequence of Spelling Autocorrect being case-sensitive, if

    • both autocorrect and capitalization are active; and

    • a word from the specified spelling error set is mis-typed at the beginning of a sentence;

    the spelling is corrected but the initial letter is not capitalized.

  2. Auto-capitalization does not work on text immediately following a soft return in non-empty TinyMCE documents.

    Auto-capitalization will not operate on the entered string if

    • a TinyMCE document contains any data other than a soft return character (Unicode U+2028, commonly entered by typing Shift+Return); and

    • the character immediately preceding an entered string is a soft return character.

  3. Auto-capitalization interferes with mediaembed, the Enhanced Media Embed Premium plugin.

  4. Auto-capitalization interferes with linkchecker, the Link Checker Premium plugin.

  5. When the Spelling Autocorrect is used with the Spell Checker Pro Premium plugin, autocorrection and capitalization are disabled when a non-English language is selected.

    Autocorrection and capitalization can, however, be re-enabled by selecting the Tools > Autocorrect menu item and the Tools > Capitalization menu item respectively.

Options

autocorrect_autocorrect

This option enables or disables spelling error autocorrection when the TinyMCE editor is loaded.

When set to true, spelling error autocorrection is enabled when TinyMCE is initialized.

The user’s preference takes precedence over the configuration at the next initialization. The user’s preference is saved to localStorage when the user enables or disables the autocorrection via the menu item.

Type: Boolean

Default value: true

Possible values: true, false

Example: using autocorrect_autocorrect

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  autocorrect_autocorrect: false
});

autocorrect_capitalize

This option enables or disables capitalization autocorrection when the TinyMCE editor is loaded.

When set to true, capitalization autocorrection is enabled when TinyMCE is initialized.

The user’s preference takes precedence over the configuration at the next initialization. The user’s preference is saved to localStorage when the user enables or disables the autocorrection via the menu item.

Type: Boolean

Default value: false

Possible values: true, false

Example: using autocorrect_capitalize

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  autocorrect_capitalize: true
});

autocorrect_service_url

This option specifies the URL of the server-side ephox-spelling service.

For instructions on how to set up a Spellchecking server-side component, see: the server-side component installation guide.

autocorrect_service_url is not required when enabling this plugin via Tiny Cloud.

Type: String

Example: using autocorrect_service_url

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  autocorrect_service_url: 'http://example.com/ephox-spelling/'
});

The Spelling Autocorrect plugin provides the following menu items:

Menu item identifier Default Menu Location Description

autocorrect

Tools

Toggles autocorrect capabilities on or off.

capitalization

Tools

Toggles capitalization capabilities on or off.

These menu items can be added to the editor using:

Events

The following events are provided by the Spelling Autocorrect plugin.

Name Data Description

AutocorrectStart

N/A

Fired when autocorrect is turned on after being off.

AutocorrectEnd

N/A

Fired when autocorrect is turned off after being on.

CapitalizeStart

N/A

Fired when capitalization is turned on after being off.

CapitalizeEnd

N/A

Fired when capitalization is turned off after being on.