Back to reference

Editor

An instance of Editor represents an HTML editor from your app enhanced with Grammarly.

declare class Editor {
  get config(): EditorConfig;
  disconnect(): void;
  setConfig(config: EditorConfig): void;
}

Examples

// returns instance of Editor
const editor = Grammarly.withElement(document.querySelector("textarea"));

Properties

configEditorConfig
Current editor configuration
Since: v1.6.3

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

NameTypeDescription
configEditorConfignew editor configuration
Last Updated: 5/12/2022, 10:30:27 PM