Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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 1.0.0-beta.4 to 1.0.0-beta.5

46

lib/index.d.ts

@@ -58,3 +58,3 @@ /**

* Higher scores indicate material that is easier to read.
* The range is typically 0 - 100, but we surface the exact amount even if lower or higher.
* The range for typical text is 0 - 100, but we surface the exact amount even if lower or higher.
*/

@@ -109,2 +109,19 @@ readabilityScore: number;

/**
* Configuration to tweak Grammarly integration.
*
* @remarks
* See {@link GrammarlyOptions}.
*
* @public
*/
interface EditorConfig extends GrammarlyOptions {
/** @internal */
cards?: {
offsets: {
inline: number;
block: number;
};
};
}
/**
* Provides more detail when the plugin is disabled by a user.

@@ -208,27 +225,2 @@ *

/**
* Configuration to tweak Grammarly integration.
*
* @remarks
* See {@link GrammarlyOptions}.
*
* @public
*/
interface EditorConfig extends GrammarlyOptions {
/** @internal */
cards: {
offsets: {
inline: number;
block: number;
};
};
/** @internal */
button: {
offsets: {
inline: number;
block: number;
};
};
}
/**
* Grammarly editor public API.

@@ -256,3 +248,3 @@ *

* @param config - Optional {@link EditorConfig}
* @returns {@link Editor}
* @returns An {@link Editor}
*/

@@ -259,0 +251,0 @@ withElement(element: HTMLElement, config?: Partial<EditorConfig>): Editor;

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

*/
function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.4";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}export{init};
function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.5";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}export{init};

@@ -17,2 +17,2 @@ !function(){"use strict";

* limitations under the License.
*/const n=new Map,t=new Set;async function r(r,e){if(n.has(r))return await n.get(r);if(t.has(r))return window.Grammarly;{const c=new Promise(((n,c)=>{if("undefined"==typeof window)return n(null);try{let i=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(r);null!=i?console.warn(`<script src="${r}" /> already exists.`):i=function(n){const t=document.createElement("script");return t.src=n,document.body.appendChild(t),t}(null!=e?`${r}?clientId=${e}`:r),i.addEventListener("load",(()=>{null!=window.Grammarly?(t.add(r),n(window.Grammarly)):c(new Error("Grammarly not available"))})),i.addEventListener("error",(function(){c(new Error(`Failed to load ${r}`))}))}catch(n){return c(n)}}));return n.set(r,c),c}}async function e(n){var t;const e=await r((void 0,`https://js.${null!==(t="grammarly.com")?t:"grammarly.com"}/grammarly-editor-sdk@1.0.0-beta.4`),n);if(null!=n)return new e.EditorFactory(n)}const c=function(){const n=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(n){const t=n.src;if(t){const n=new URL(t).searchParams.get("clientId");if(null!=n)return n}const r=n.getAttribute("clientId");if(null!=r)return r}}();null!=c?e(c):e()}();
*/const n=new Map,t=new Set;async function r(r,e){if(n.has(r))return await n.get(r);if(t.has(r))return window.Grammarly;{const c=new Promise(((n,c)=>{if("undefined"==typeof window)return n(null);try{let i=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(r);null!=i?console.warn(`<script src="${r}" /> already exists.`):i=function(n){const t=document.createElement("script");return t.src=n,document.body.appendChild(t),t}(null!=e?`${r}?clientId=${e}`:r),i.addEventListener("load",(()=>{null!=window.Grammarly?(t.add(r),n(window.Grammarly)):c(new Error("Grammarly not available"))})),i.addEventListener("error",(function(){c(new Error(`Failed to load ${r}`))}))}catch(n){return c(n)}}));return n.set(r,c),c}}async function e(n){var t;const e=await r((void 0,`https://js.${null!==(t="grammarly.com")?t:"grammarly.com"}/grammarly-editor-sdk@1.0.0-beta.5`),n);if(null!=n)return new e.EditorFactory(n)}const c=function(){const n=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(n){const t=n.src;if(t){const n=new URL(t).searchParams.get("clientId");if(null!=n)return n}const r=n.getAttribute("clientId");if(null!=r)return r}}();null!=c?e(c):e()}();

@@ -17,2 +17,2 @@ "use strict";

* limitations under the License.
*/Object.defineProperty(exports,"__esModule",{value:true});function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.4";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}exports.init=init;
*/Object.defineProperty(exports,"__esModule",{value:true});function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.5";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}exports.init=init;

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

"description": "Grammarly writing SDK for web editors",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"main": "lib/index.js",

@@ -27,4 +27,4 @@ "module": "lib/index.esm.js",

"devDependencies": {
"@grammarly/plugin-core": "1.0.0-beta.4",
"@grammarly/plugin-editor": "1.0.0-beta.4",
"@grammarly/plugin-core": "1.0.0-beta.5",
"@grammarly/plugin-editor": "1.0.0-beta.5",
"@microsoft/api-extractor": "^7.15.1",

@@ -31,0 +31,0 @@ "@types/jest": "^26.0.22",

@@ -16,3 +16,3 @@ # Grammarly Editor SDK

const Grammarly = await init("CLIENT ID");
const Grammarly = await init("YOUR_CLIENT_ID");

@@ -19,0 +19,0 @@ Grammarly.withElement(

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