Editor
An instance of Editor represents an HTML editor from your app enhanced with Grammarly.
See EditorConfig to customize per editor instance.
declare class Editor {
get config(): EditorConfig;
disconnect(): void;
get element(): GrammarlyEditorPluginElement;
setConfig(config: EditorConfig): void;
}
Examples
// returns instance of GrammarlyEditorPluginElement
const grammarlyPluginElement = Grammarly.addPlugin(document.querySelector("textarea"));
Properties
elementType: GrammarlyEditorPluginElement
Returns the GrammarlyEditorPlugin element directly if you need to connect to it after the DOM has changed.
Since: v1.7.5
Methods
disconnect()
Close Grammarly connection and clean up any state.
disconnect(): void;
setConfig()
Update editor configuration by merging new configuration with current configuration.
Setting a property to undefined
would remove it, e.g., setConfig({ documentDialect: undefined })
would remove configured dialect.
setConfig(config: EditorConfig): void;
Parameters
Name | Type | Description |
---|---|---|
config | EditorConfig | new editor configuration |