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 1.0.0 to 1.0.1

18

lib/index.d.ts
/**
* Grammarly writing SDK for web editors
* @packageDocumentation
* @license
* (c) Copyright 2021 Grammarly, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -339,4 +353,6 @@

* @param selectors - Selectors as provided to {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll | `querySelectorAll`}
* @param config - Optional {@link EditorConfig}
* @returns An {@link Editor}
*/
withQuerySelector(selectors: string): void;
withQuerySelector(selectors: string, config?: Partial<EditorConfig>): void;
/** @internal */

@@ -343,0 +359,0 @@ withText(text: string): Editor;

2

lib/index.esm.js

@@ -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[versionMajor,versionMinor]="1.0.0".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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.head.appendChild(script);return script}const promises=new Map;const scripts=new Set;function initGrammarlyGlobalAPI(){if(window.Grammarly!=null)return;window.Grammarly={}}async function loadScript(url,clientId){initGrammarlyGlobalAPI();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[versionMajor,versionMinor]="1.0.1".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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};

@@ -1,17 +0,17 @@

!function(){"use strict";
/**
* @license
* (c) Copyright 2021 Grammarly, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* 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}}const[e,c]="1.0.0".split("."),i=`${e}.${c}`;async function o(n){var t;const e=await r((void 0,`https://js.${null!==(t="grammarly.com")?t:"grammarly.com"}/grammarly-editor-sdk@${i}`),n);if(null!=n)return new e.EditorFactory(n)}const a=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!=a?o(a):o()}();
* @license
* (c) Copyright 2021 Grammarly, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(){"use strict";const n=new Map,r=new Set;async function t(t,e){if(null==window.Grammarly&&(window.Grammarly={}),n.has(t))return await n.get(t);if(r.has(t))return window.Grammarly;{const i=new Promise(((n,i)=>{if("undefined"==typeof window)return n(null);try{let a=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(t);null!=a?console.warn(`<script src="${t}" /> already exists.`):a=function(n){const r=document.createElement("script");return r.src=n,document.head.appendChild(r),r}(null!=e?`${t}?clientId=${e}`:t),a.addEventListener("load",(()=>{null!=window.Grammarly?(r.add(t),n(window.Grammarly)):i(new Error("Grammarly not available"))})),a.addEventListener("error",(function(){i(new Error(`Failed to load ${t}`))}))}catch(n){return i(n)}}));return n.set(t,i),i}}const[e,i]="1.0.1".split("."),a=`${e}.${i}`;async function o(n){var r;const e=await t((void 0,`https://js.${null!==(r="grammarly.com")?r:"grammarly.com"}/grammarly-editor-sdk@${a}`),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 r=n.src;if(r){const n=new URL(r).searchParams.get("clientId");if(null!=n)return n}const t=n.getAttribute("clientId");if(null!=t)return t}}(),l=null!=c?o(c):void 0;window.Grammarly.init=async(n=c)=>{const r=c===n?await l:null!=n?await o(n):void 0;if(null==r)throw new Error('A "clientId" is required to init Grammarly SDK.');return r}}();

@@ -1,2 +0,1 @@

"use strict";
/**

@@ -17,2 +16,3 @@ * @license

* 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[versionMajor,versionMinor]="1.0.0".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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;
*/
"use strict";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.head.appendChild(script);return script}const promises=new Map;const scripts=new Set;function initGrammarlyGlobalAPI(){if(window.Grammarly!=null)return;window.Grammarly={}}async function loadScript(url,clientId){initGrammarlyGlobalAPI();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[versionMajor,versionMinor]="1.0.1".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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",
"version": "1.0.1",
"main": "lib/index.js",

@@ -18,3 +18,3 @@ "module": "lib/index.esm.js",

"type": "git",
"url": "git://github.com/grammarly/javascript-plugin.git"
"url": "git://github.com/grammarly/grammarly-for-developers.git"
},

@@ -28,4 +28,4 @@ "files": [

"devDependencies": {
"@grammarly/plugin-core": "1.0.0",
"@grammarly/plugin-editor": "1.0.0",
"@grammarly/plugin-core": "1.0.1",
"@grammarly/plugin-editor": "1.0.1",
"@microsoft/api-extractor": "^7.15.1",

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

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