@grammarly/editor-sdk

Overview

See the Text Editor SDK guide for installation options.

The Text Editor SDK can be configured according to your app's needs. For example, withElement accepts a configuration object as its optional second parameter:

import { init } from "@grammarly/editor-sdk";

const Grammarly = await init("YOUR_CLIENT_ID");

Grammarly.withElement(
  document.querySelector("textarea"),
  { documentDialect: "british" },
);

This allows your app to:

  • specify information about the end user's input to improve Grammarly's suggestions
  • influence Grammarly suggestion types (SuggestionCategories)
  • react to events (onPluginDisable, onPluginError, onTextStats)

Refer to EditorConfig for full details.

Theming

CSS variables that allow you to theme your app are detailed in Customization.

Reference

Last Updated: 6/28/2022, 7:24:10 PM