Back to reference

EditorSDK

Overall API for the Editor SDK which can be used to create an Editor, which represents an HTML editor enhanced with Grammarly.

declare class EditorSDK {
  addPlugin(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): GrammarlyEditorPluginElement;
  handleOAuthCallback(url: string): Promise<void>;
}

Examples

const Grammarly = await init("YOUR_CLIENT_ID");
const grammarlyPluginElement = Grammarly.addPlugin(document.querySelector("textarea"));

Methods

addPlugin()

Enhance a specific HTML element with Grammarly.

addPlugin(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): GrammarlyEditorPluginElement;

Parameters

NameTypeDescription
elementHTMLElementElement to be enhanced
configEditorConfigOptional EditorConfig
viewportHTMLElementParent scrolling element, if different from editor element (since 1.6.7)

handleOAuthCallback()

Process OAuth callback and complete account connection.

handleOAuthCallback(url: string): Promise<void>;

Parameters

NameTypeDescription
urlstring
Last Updated: 5/2/2023, 10:58:56 PM