SpellCheckExtensions.AddSpellCheck(IDevExpressBlazorBuilder, Action<SpellCheckOptions, IServiceProvider>) Method
Adds the built-in spell check service to the application’s service collection and configures service options and a provider.
Namespace: DevExpress.Blazor.RichEdit.SpellCheck
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
Declaration
public static IDevExpressBlazorBuilder AddSpellCheck(
this IDevExpressBlazorBuilder builder,
Action<SpellCheckOptions, IServiceProvider> configure
)
Parameters
Name | Type | Description |
---|---|---|
builder | IDevExpressBlazorBuilder | An object that can be used to further configure internal DevExpress Blazor services. |
configure | Action<SpellCheckOptions, IServiceProvider> | A delegate method that implements external services within service options. |
Returns
Type | Description |
---|---|
IDevExpressBlazorBuilder | An object that can be used to further configure internal DevExpress Blazor services. |
Remarks
Call the AddSpellCheck
method to register external spell check services within the following options:
- AddToDictionaryAction
- Allows you to implement a delegate method that writes the selected word to a dictionary file. The Rich Text Editor executes this method after a user clicks the Add to dictionary command in the context menu. If you do not set the
AddToDictionaryAction
property value, the component hides the command. - Dictionaries
- Stores a list of dictionaries you added. To extend the dictionary list, pass a simple, ISpell, or Hunspell dictionary to the list’s
Add
method. - FileProvider
- Specifies a file provider that accesses dictionary files. The FileNotFoundException error occurs if you add a dictionary without specifying a file provider.
- MaxSuggestionCount
- Specifies the maximum number of suggestions that the Rich Text Editor should display in its context menu. The component can display up to 15 suggestions.
The following code snippet retrieves a logging service within the AddToDictionaryAction:
var builder = WebApplication.CreateBuilder(args);
// ...
builder.Services.AddSingleton<ILoggingService, LoggingService>();
builder.Services.AddDevExpressBlazor().AddSpellCheck((options, serviceProvider) => {
options.AddToDictionaryAction = (word, culture) => {
var loggingService = serviceProvider.GetRequiredService<ILoggingService>();
loggingService.LogWord(word);
};
});
// ...
var app = builder.Build();