Document editor supports performing spell checking for any input text. You can perform spell checking for the text in Document Editor and it will provide suggestions for the mis-spelled words through dialog and in context menu.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import {
DocumentEditorComponent, DocumentEditor
} from '@syncfusion/ej2-react-documenteditor';
export class Default extends React.Component<{}, {}> {
public documenteditor: DocumentEditorComponent;
public componentDidMount(): void {
this.documentEditor.spellChecker.languageID = 1033 //LCID of "en-us";
this.documentEditor.spellChecker.removeUnderline = false;
this.documentEditor.spellChecker.allowSpellCheckAndSuggestion = true;
}
render() {
return (
<DocumentEditorComponent id="container" ref={(scope) => { this.documenteditor = scope; }} />
);
}
}
ReactDOM.render(<Default />, document.getElementById('sample'));
To enable spell check in DocumentEditor, set enableSpellCheck
property as true
and then configure SpellCheckSettings.
To disable spell check in DocumentEditor, set enableSpellCheck
property as false
or remove enableSpellCheck
property initialization code. The default value of this property is false.
By default, mis-spelled words are marked with squiggly line. You can also disable this behavior by enabling the removeUnderline
API and now, the squiggly lines will never be rendered for mis-spelled words.
documentEditor.spellChecker.removeUnderline = false;
By default, on performing spell check in Document Editor, both spelling and suggestions of the mis-spelled words will be retrieved, and this mis-spelled words can be corrected through context menu suggestions. You can modify this behavior using the allowSpellCheckAndSuggestion
API, which will perform only spell check.
documentEditor.spellChecker.allowSpellCheckAndSuggestion = false;
Document Editor provides multi-language spell check support. You can add as many languages (dictionaries) in the server-side and to use that language for spell checking in Document Editor, it must be matched with languageID
you pass in the Document Editor.
documentEditor.spellChecker.languageID = 1033; //LCID of "en-us";