Configuring Spellchecker

Installation and usage is pretty straightforward. You have to install the following package in your solution:

Install-Package EPiServer.TinyMCESpellChecker

The Spellcheck button will be added at the end of the toolbar.

There are many dictionaries that are included with the add-on by default, but if you get an error message as follows, you should install the missing dictionary.

To fix it, I am going to use the English dictionary that comes with the add-on, and I will rename it to “en-US” to fit the default language of my site:

  1. Unzip the file EPiServer.TinyMCESpellChecker.zip which is located at \modules\_protected\EPiServer.TinyMCESpellChecker
  2. Copy the files from Dictionaries\en and paste them in the add-on folder \modules\_protected\EPiServer.TinyMCESpellChecker\Dictionaries\en-US
  3. Make sure the file structure looks like:

Using Spellchecker for specific properties

The following code shows how to configure Spellchecker only for the MainBody of the Product Page:

[ModuleDependency(typeof(EPiServer.TinyMCESpellChecker.InitializationModule))]
public class ExtendedTinyMceInitialization : IConfigurableModule
{
    private ServiceConfigurationContext _serviceConfigurationContext;

    public void Initialize(InitializationEngine context)
    {
        _serviceConfigurationContext.Services.Configure<TinyMceConfiguration>(config =>
        {
            config.For<ProductPage>(p => p.MainBody, config.Default())
                .DisableMenubar()
                .Toolbar("bold italic underline strikethrough | spellchecker");
        });
    }

    public void Uninitialize(InitializationEngine context)
    { 
    }

    public void ConfigureContainer(ServiceConfigurationContext context)
    {
        // Always use the Initialize method to configure a custom property
        this._serviceConfigurationContext = context;
    }
}
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s