Back to Devexpress

Spell Check

aspnetcore-401928-rich-edit-spell-check.md

latest3.6 KB
Original Source

Spell Check

  • Jan 15, 2025
  • 4 minutes to read

The RichEdit control allows you to use third-party tools to implement spell check. Use the client spellCheck option or the server SpellCheck(Action<SpellCheckBuilder>) method (for .NET Core) to specify the following settings:

Client Property.NET Core Server MethodDescription
enabledEnabled(Boolean)Specifies whether the spell check is enabled.
checkWordSpellingCheckWordSpelling(String)A function that checks a word.
suggestionCountSuggestionCount(Int32)The maximum number of suggested words that can be displayed in the context menu.
addWordToDictionaryAddWordToDictionary(String)A function that is called when a user clicks the Add to Dictionary context menu command.

The isEnabled property allows you to enable and disable spell check at runtime:

javascript
richEdit.spellCheckerOptions.isEnabled = false;

Tip

If your application is built on the Angular framework, refer to following section for instructions on how to implement spell check in the RichEdit: Angular Application - Spell Check.

Create an nspell Bundle for the RichEdit

The RichEdit npm package includes a webpack configuration file that allows you to compile the nspell library and dictionaries into a package bundle. The configuration file references the English dictionary.

Follow the steps below to compile the bundle.

  1. Run the following commands within the project’s root directory:

  2. Add the import directive for every additional dictionary to the node_modules/devexpress-richedit/bin/nspell-index.js file.

  3. Register additional dictionaries with a corresponding “lang” attribute prior to the default English dictionary to use them first while spell checking.

  4. Run the following command that builds an nspell bundle according to the node_modules/devexpress-richedit/bin/nspell.webpack.config.js configuration file:

Use nspell With Web Worker

  1. Create the spell-checker-worker.js file with the following content:

  2. Place the nspell.js and spell-checker-worker.js files into the directory that contains the control scripts ( wwwroot for .NET Core, Scripts for MVC and Web Forms).

  3. For an application on a client framework, add the following code to the page that contains the RichEdit control: