Socket
Socket
Sign inDemoInstall

@grammarly/editor-sdk

Package Overview
Dependencies
Maintainers
7
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grammarly/editor-sdk - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

43

lib/editor-sdk.beta.d.ts

@@ -18,2 +18,4 @@ /**

export { Event, EventListener } from '@grammarly/reactivity';
/**

@@ -163,3 +165,3 @@ * Identifier used to authenticate with Grammarly.

*
* @remarks Suggestion categories are available only on the Plus plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @remarks Muting suggestion categories is available only on the Plus plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @demo {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-suggestions-config?file=/public/index.html | Try it now}

@@ -174,3 +176,3 @@ * @public

*
* @remarks In product surveys are required for Free plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @remarks User feedback is required for the Free plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @defaultValue "on"

@@ -254,3 +256,5 @@ * @public

* Activation strategy used by the Editor Plugin
*
* - focus: Plugin activates once the text field is focused
*
* - immediate: Plugin activates immediately

@@ -260,3 +264,3 @@ *

* @public
* @since v2.0.0-alpha.1
* @since v2.0.0
*/

@@ -301,32 +305,2 @@ activation?: "focus" | "immediate";

/**
* Custom event
*
* @public
*/
declare class Event_2<T> {
/**
* Event name
*
* @public
*/
readonly type: string;
/**
* Event payload
*
* @public
*/
readonly detail: T;
constructor(name: string, detail: T);
}
/**
* Event handler callback
*
* @public
*/
declare type EventListener_2<T> = (event: Event_2<T>) => void | Promise<void>;
/**
* `<grammarly-button>` is a web component that allows you to place the Grammarly button

@@ -433,2 +407,3 @@ * in a custom position in your app.

private readonly _logger;

@@ -835,2 +810,2 @@

export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };
export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };

@@ -18,2 +18,4 @@ /**

export { Event, EventListener } from '@grammarly/reactivity';
/**

@@ -163,3 +165,3 @@ * Identifier used to authenticate with Grammarly.

*
* @remarks Suggestion categories are available only on the Plus plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @remarks Muting suggestion categories is available only on the Plus plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @demo {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-suggestions-config?file=/public/index.html | Try it now}

@@ -174,3 +176,3 @@ * @public

*
* @remarks In product surveys are required for Free plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @remarks User feedback is required for the Free plan. {@link https://developer.grammarly.com/plans | Learn more} about our plans.
* @defaultValue "on"

@@ -246,3 +248,5 @@ * @public

* Activation strategy used by the Editor Plugin
*
* - focus: Plugin activates once the text field is focused
*
* - immediate: Plugin activates immediately

@@ -252,3 +256,3 @@ *

* @public
* @since v2.0.0-alpha.1
* @since v2.0.0
*/

@@ -293,32 +297,2 @@ activation?: "focus" | "immediate";

/**
* Custom event
*
* @public
*/
declare class Event_2<T> {
/**
* Event name
*
* @public
*/
readonly type: string;
/**
* Event payload
*
* @public
*/
readonly detail: T;
constructor(name: string, detail: T);
}
/**
* Event handler callback
*
* @public
*/
declare type EventListener_2<T> = (event: Event_2<T>) => void | Promise<void>;
/**
* `<grammarly-button>` is a web component that allows you to place the Grammarly button

@@ -425,2 +399,3 @@ * in a custom position in your app.

private readonly _logger;

@@ -827,2 +802,2 @@

export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };
export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };

@@ -17,2 +17,2 @@ /**

*/
function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",r.toString()),n.forEach((t=>o.searchParams.append("args",String(t)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(o.toString()," for details."),this.args=n,this.code=r,this.url=o.toString()}}const n=new WeakMap;async function e(t,e,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const a=await async function(t,e,o){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const s=new Promise(((n,a)=>{try{let n=function(t,r){return t.document.querySelectorAll(`script[src^="${r}"]`)[0]}(t,e);null!=n?s():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=o?`${e}?clientId=${o}`:e),n.addEventListener("load",s),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function s(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){a(t)}}}));return n.set(t,s),await s}(null!=o?o:window,"https://js.grammarly.com/grammarly-editor-sdk@2.0",t);if(null!=t)return new a.EditorSDK(t,e)}const o={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{o as callbackToEventName,e as init};
function t(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var r=new Map;class e extends Error{constructor(r,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",r.toString()),e.forEach((t=>a.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="".concat(n,"Minified error #").concat(r,": See ").concat(a.toString()," for details."),this.args=e,this.code=r,this.url=a.toString()}toUserMessage(){var t=r.get("".concat(this.code));if(null==t)return[this];var e=new Map(this.args.map(((t,r)=>["${".concat(r,"}"),t])));return t.split(/(\${\d+})/).filter((t=>""!==t)).map((t=>{var r;return null!==(r=e.get(t))&&void 0!==r?r:t}))}static setMessages(t){r=t}static create(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3?arguments[3]:void 0;null!=a&&r.push(a);var o=new e(t,r,n);return o.stack=null==a?void 0:a.stack,o}}const n=new WeakMap;async function a(t,r,e){return await o("@grammarly/editor-sdk",t,r,e)}async function o(t,r,a,o){if("undefined"==typeof window&&void 0===o)throw new e(21,[]);const s=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.0",location.origin);null!=r&&s.searchParams.set("clientId",r),s.searchParams.set("packageName",t);const i=await async function(t,r){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const o=new Promise(((n,a)=>{try{let n=function(t,r){return t.document.querySelectorAll(`script[src^="${r.replace(/\?.*$/,"")}"]`)[0]}(t,r);null!=n?o():(n=function(t,r){const e=t.document.createElement("script");return e.src=r,t.document.head.appendChild(e),e}(t,r),n.addEventListener("load",o),n.addEventListener("error",(function(){try{throw new e(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function o(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new e(22,[]);n(t.Grammarly)}catch(t){a(t)}}}));return n.set(t,o),await o}(null!=o?o:window,s.toString());if(null!=r)return new i.EditorSDK(r,a)}const s={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{o as _init,s as callbackToEventName,a as init};

@@ -17,2 +17,2 @@ /**

*/
!function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",r.toString()),n.forEach((t=>a.searchParams.append("args",String(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(a.toString()," for details."),this.args=n,this.code=r,this.url=a.toString()}}const n=new WeakMap;async function e(t,e,a){if("undefined"==typeof window&&void 0===a)throw new r(21,[]);const c=await async function(t,e,a){const c=n.get(t);if(null!=c)return await c;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const i=new Promise(((n,c)=>{try{let n=function(t,r){return t.document.querySelectorAll('script[src^="https://js.grammarly.com/grammarly-editor-sdk@2.0"]')[0]}(t);null!=n?i():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=a?`${e}?clientId=${a}`:e),n.addEventListener("load",i),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){c(t)}})))}catch(t){return c(t)}function i(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){c(t)}}}));return n.set(t,i),await i}(null!=a?a:window,"https://js.grammarly.com/grammarly-editor-sdk@2.0",t);if(null!=t)return new c.EditorSDK(t,e)}const a=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const r=t.src;if(r){const t=new URL(r).searchParams.get("clientId");if(null!=t)return t}const n=t.getAttribute("clientId");if(null!=n)return n}}(),c=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=a?e(a):e());window.Grammarly.init=async(t=a)=>{const n=a===t?await c:null!=t?await e(t):void 0;if(null==n)throw new r(20,[]);return n}}();
!function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}var r=new Map;class n extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",r.toString()),n.forEach((t=>a.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="".concat(e,"Minified error #").concat(r,": See ").concat(a.toString()," for details."),this.args=n,this.code=r,this.url=a.toString()}toUserMessage(){var t=r.get("".concat(this.code));if(null==t)return[this];var n=new Map(this.args.map(((t,r)=>["${".concat(r,"}"),t])));return t.split(/(\${\d+})/).filter((t=>""!==t)).map((t=>{var r;return null!==(r=n.get(t))&&void 0!==r?r:t}))}static setMessages(t){r=t}static create(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3?arguments[3]:void 0;null!=a&&r.push(a);var c=new n(t,r,e);return c.stack=null==a?void 0:a.stack,c}}const e=new WeakMap;async function a(t,r,a){return await async function(t,r,a,c){if("undefined"==typeof window&&void 0===c)throw new n(21,[]);const i=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.0",location.origin);null!=r&&i.searchParams.set("clientId",r),i.searchParams.set("packageName","@grammarly/editor-sdk");const o=await async function(t,r){const a=e.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const c=new Promise(((e,a)=>{try{let e=function(t,r){return t.document.querySelectorAll(`script[src^="${r.replace(/\?.*$/,"")}"]`)[0]}(t,r);null!=e?c():(e=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,r),e.addEventListener("load",c),e.addEventListener("error",(function(){try{throw new n(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function c(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new n(22,[]);e(t.Grammarly)}catch(t){a(t)}}}));return e.set(t,c),await c}(null!=c?c:window,i.toString());if(null!=r)return new o.EditorSDK(r,a)}(0,t,r,a)}const c=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const r=t.src;if(r){const t=new URL(r).searchParams.get("clientId");if(null!=t)return t}const n=t.getAttribute("clientId");if(null!=n)return n}}(),i=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=c?a(c):a());window.Grammarly.init=async(t=c)=>{const r=c===t?await i:null!=t?await a(t):void 0;if(null==r)throw new n(20,[]);return r}}();

@@ -17,2 +17,2 @@ /**

*/
"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class t extends Error{constructor(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),e(this,"args",void 0),e(this,"code",void 0),e(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",t.toString()),r.forEach((e=>o.searchParams.append("args",String(e)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="Minified error #".concat(t,": ").concat(n," See ").concat(o.toString()," for details."),this.args=r,this.code=t,this.url=o.toString()}}const r=new WeakMap;exports.callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"},exports.init=async function(e,n,o){if("undefined"==typeof window&&void 0===o)throw new t(21,[]);const a=await async function(e,n,o){const a=r.get(e);if(null!=a)return await a;!function(e){null==e.Grammarly&&(e.Grammarly={})}(e);const s=new Promise(((r,a)=>{try{let r=function(e,t){return e.document.querySelectorAll(`script[src^="${t}"]`)[0]}(e,n);null!=r?s():(r=function(e,t){const r=e.document.createElement("script");return r.src=t,e.document.head.appendChild(r),r}(e,null!=o?`${n}?clientId=${o}`:n),r.addEventListener("load",s),r.addEventListener("error",(function(){try{throw new t(23,[])}catch(e){a(e)}})))}catch(e){return a(e)}function s(){try{if(null==e.Grammarly||"function"!=typeof e.Grammarly.EditorSDK)throw new t(22,[]);r(e.Grammarly)}catch(e){a(e)}}}));return r.set(e,s),await s}(null!=o?o:window,"https://js.grammarly.com/grammarly-editor-sdk@2.0",e);if(null!=e)return new a.EditorSDK(e,n)};
"use strict";function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=new Map;class r extends Error{constructor(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",e.toString()),r.forEach((t=>a.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="".concat(n,"Minified error #").concat(e,": See ").concat(a.toString()," for details."),this.args=r,this.code=e,this.url=a.toString()}toUserMessage(){var t=e.get("".concat(this.code));if(null==t)return[this];var r=new Map(this.args.map(((t,e)=>["${".concat(e,"}"),t]))),n=t.split(/(\${\d+})/).filter((t=>""!==t));return n.map((t=>{var e;return null!==(e=r.get(t))&&void 0!==e?e:t}))}static setMessages(t){e=t}static create(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3?arguments[3]:void 0;null!=a&&e.push(a);var o=new r(t,e,n);return o.stack=null==a?void 0:a.stack,o}}const n=new WeakMap;async function a(t,e){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const o=new Promise(((n,a)=>{try{let n=function(t,e){return t.document.querySelectorAll(`script[src^="${e.replace(/\?.*$/,"")}"]`)[0]}(t,e);null!=n?o():(n=function(t,e){const r=t.document.createElement("script");return r.src=e,t.document.head.appendChild(r),r}(t,e),n.addEventListener("load",o),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function o(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){a(t)}}}));return n.set(t,o),await o}async function o(t,e,n,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const s=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.0",location.origin);null!=e&&s.searchParams.set("clientId",e),s.searchParams.set("packageName",t);const i=await a(null!=o?o:window,s.toString());if(null!=e)return new i.EditorSDK(e,n)}exports._init=o,exports.callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"},exports.init=async function(t,e,r){return await o("@grammarly/editor-sdk",t,e,r)};

@@ -5,3 +5,14 @@ {

"description": "Grammarly writing SDK for web editors",
"version": "2.0.0",
"keywords": [
"grammarly",
"grammar",
"spellcheck",
"spell-check",
"spelling",
"proofreading",
"english",
"writing",
"readability"
],
"version": "2.0.1",
"main": "./lib/index.js",

@@ -17,2 +28,3 @@ "module": "./lib/index.esm.js",

},
"homepage": "https://developer.grammarly.com/docs",
"repository": {

@@ -30,6 +42,6 @@ "type": "git",

"devDependencies": {
"@grammarly/plugin-core": "2.0.0",
"@grammarly/plugin-editor": "2.0.0",
"@grammarly/plugin-invariant": "2.0.0",
"@grammarly/plugin-reactivity": "2.0.0",
"@grammarly/plugin-core": "2.0.1",
"@grammarly/plugin-editor": "2.0.1",
"@grammarly/plugin-invariant": "2.0.1",
"@grammarly/plugin-reactivity": "2.0.1",
"@microsoft/api-extractor": "^7.28.7",

@@ -36,0 +48,0 @@ "@testing-library/jest-dom": "^5.11.10",

@@ -1,22 +0,45 @@

# Grammarly Editor SDK
# Grammarly Text Editor SDK
Bringing the Grammarly experience to any web application. No browser extension required.
Add Grammarly's real-time writing support to your app with just a few lines of code.
![A code snippet shows how to add the Grammarly Text Editor Plugin to a textarea. Then an animation of a user accepting a Grammarly suggestion in a chat app appears.](https://github.com/grammarly/grammarly-for-developers/blob/main/docs/sdk_product_animation.gif?raw=true)
This package is designed for vanilla JavaScript apps. Visit [@grammarly/editor-sdk-react](https://www.npmjs.com/package/@grammarly/editor-sdk-react) for our package for React apps and [@grammarly/editor-sdk-vue](https://www.npmjs.com/package/@grammarly/editor-sdk-vue) for our package for Vue apps.
## Getting started
Install the Grammarly editor SDK:
Here's how to get started:
```bash
npm install @grammarly/editor-sdk
```
1. Create a new [Grammarly for Developers app](https://developer.grammarly.com/apps)
1. Install the Grammarly Text Editor SDK:
```ts
import { init } from "@grammarly/editor-sdk";
```bash
npm install @grammarly/editor-sdk
```
const Grammarly = await init("YOUR_CLIENT_ID");
1. Initialize the SDK with your client ID:
Grammarly.addPlugin(
// Textarea, input or content-editable element
document.querySelector("textarea"),
);
```
```ts
import * as Grammarly from "@grammarly/editor-sdk";
Grammarly.init("YOUR_CLIENT_ID");
```
1. Add the Grammarly Text Editor Plugin to your text editors by wrapping them with the [grammarly-editor-plugin](https://developer.grammarly.com/docs/api/editor-sdk/grammarlyeditorpluginelement) web component.
```ts
<grammarly-editor-plugin>
<textarea></textarea>
</grammarly-editor-plugin>
```
## Learn more
If you'd like to learn more about what you can do with the SDK and how you can customize the plugin for your app, visit:
- [Grammarly for Developers Documentation](https://developer.grammarly.com/docs/)
- [Grammarly for Developers API Reference](https://developer.grammarly.com/docs/api/editor-sdk)
- [Grammarly for Developers Code Examples on GitHub](https://github.com/grammarly/grammarly-for-developers)
## Ask a question
If you want to ask a question, share a suggestion, or chat about how you're using the Grammarly Text Editor SDK in your app, join us in the [Grammarly for Developers community on GitHub](https://github.com/grammarly/grammarly-for-developers/discussions).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc