Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Conflict with Grammarly chrome extension #616

Closed
danjstern opened this issue Aug 24, 2016 · 102 comments
Closed

Conflict with Grammarly chrome extension #616

danjstern opened this issue Aug 24, 2016 · 102 comments

Comments

@danjstern
Copy link

danjstern commented Aug 24, 2016

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
When using the Grammarly extension which has 10K reviews in the google app store (with 4.5 stars), text that you type occasionally stops.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Using the draft.js sample site, you can see the behavior in this video: http://screencast.com/t/8xhRQz9sZt

It seems to be related to when grammarly detects an issue.

What is the expected behavior?
Not to erase text.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
Current version in Chrome on OS X 10.11.4

@olmg-justin-ligman
Copy link

Any updates on this, or does anybody know of a workaround? We are working on a project using Draft.js, and would like to integrate with Grammarly if possible.

It seems that Grammarly is injecting spans into the editor, wrapping any errors it finds, and this throws the editor into a state where the selection changes suddenly, and there doesn't appear to be a way to differentiate this from a normal selection.

@jonathanwilke
Copy link

I got the same problem, but I see that facebook.com is using draft-js as in the "status update editor" and this editor doesn't have this problem. I figured out that on facebook.com grammarly is creating a grammarly-ghost div instead of wrapping the text in a span. Does anyone know how to achieve this?

@olmg-justin-ligman
Copy link

Has anyone found a workaround for this, or are there any updates?

@ghost
Copy link

ghost commented Oct 3, 2016

I've filed a support ticket with Grammarly. I'll post any updates here.

@ghost
Copy link

ghost commented Oct 16, 2016

I contacted the Grammarly folks, and the support wasn't helpful at all.

At this time, due to technical incompatibility, Grammarly malfunctions on the reported pages. The only workaround is to disable Grammarly for the following pages.

I have escalated your case to the development team. I can confirm that our engineers have backlogged the issue and plan on resolving it at their earliest convenience.

Unfortunately, this will not be a quick fix and I cannot provide you with an estimated timeframe, as the developers will need some time to analyze the cause of this issue.

I pointed out that they've already solved the issue on Facebook.com, and offered a few suggestions to fix it everywhere, but I was returned the usual customer support responses.

Such a shame, because our clients love Grammarly. It wasn't pleasant telling them they can't use it.

@kigorw
Copy link

kigorw commented Oct 19, 2016

Hi, I'm a developer from Grammarly. Facebook fields are simpler because they are plain-text only. We can't easily use the same technique to support Draft.js. It's a rich-text editor.
Right now we are working on integration guidelines that will help developers of text editors to support Grammarly.
In meantime, I would love to chat with Draft.js developers to show a draft of API spec and get feedback from them. My email: kigorw@grammarly.com

@olmg-justin-ligman
Copy link

@kigorw - thanks for commenting on this issue!

FYI - Facebook's Notes app uses Draft.js, and even though it has issues, it doesn't mess up as bad as the example on Draft's homepage. For instance, if you type an error and wait for Grammarly to detect it, then start typing again, it doesn't change the cursor position or overwrite any characters like the example on the homepage does. I doubt this helps much but I wanted to point it out in case it did.

I would love to see these things work together, so hopefully somebody from the Draft team reaches out and you can come up with something (even a workaround would be great).

@gdehmlow
Copy link

gdehmlow commented Nov 2, 2016

If Grammarly offered any sort of API it would be very easy to integrate it directly into the editor itself. I hope this happens sooner rather than later. I'm really surprised they don't offer one already.

@bruinebeer
Copy link

Hmm, this pretty much breaks the whole editor. Is there any way to detect Grammarly? I could then inform the user about the compatibility issues..

@nuc
Copy link

nuc commented Nov 15, 2016

@markpradhan You can always disable it by editor.setAttribute('data-gramm', 'false') (editor being the draft-js editor instance).

@bruinebeer
Copy link

@nuc it's really hard to set attributes to draft-js editor :/ can't get it to work.. is there no way to detect grammarly?

@nuc
Copy link

nuc commented Nov 15, 2016

@markpradhan Why is it hard? For us it works well in componentDidMount like that:

  componentDidMount() {
    const { editor } = this.refs
    const draftEditor = editor.refs.editor
    draftEditor.setAttribute('data-gramm', 'false')
  }

@bruinebeer
Copy link

yeah, i figured it out as well.. was just about to post it here, but your solution is more elegant :D

@avk
Copy link

avk commented Nov 29, 2016

For anyone using the draft-js-plugins editor, I had to do the following to disable Grammarly:

  componentDidMount() {
    // disable Grammarly extension, incompatible with draft.js
    // https://github.com/facebook/draft-js/issues/616
    const pluginEditor = this.refs.editor;
    const draftEditor = pluginEditor.refs.editor;
    const contentEditable = draftEditor.refs.editor;
    ReactDOM.findDOMNode(contentEditable).setAttribute('data-gramm', 'false');
  }

@avk
Copy link

avk commented Nov 29, 2016

@kigorw could you please provide an update from Grammarly's side? Are there any plans to take an intermediate step and disable Grammarly on all Draft.js editors? Otherwise people using Grammarly on a site with a Draft.js editor seem extremely likely to lose their writing...

@kigorw
Copy link

kigorw commented Dec 7, 2016

We released an update that skips all draft.js powered fields. Let me know if you still have somewhere this problem.

@tylercraft
Copy link
Contributor

Looks like this was fixed on Grammerly's side, so I'm going to close this out.

@hejtmii
Copy link

hejtmii commented Sep 13, 2017

FYI: I am working on making the editor compatible with Grammarly, and potentially with other extensions that decorate the DOM text with extra tags for its metadata.

So far I managed to handle proper sync of selection and update on input so that editing works and it displays Grammarly suggestions properly.

As Grammarly doesn't fire onInput event while applying fixes, the editor doesn't catch such change. I plan to experiment with MutationObserver to handle this part, after which Grammarly might fully work with the editor.

The work is progress is here if anyone is interested:
https://github.com/kenticomartinh/draft-js/tree/experiments/Grammarly_demo

My questions are the following:

  • Is this something that editor authors would be willing to adopt to its code if it works and is properly tested?
  • Should we handle this in this issue or create a new issue for it? (As this one is about the collision, not necessarily about making Grammarly work with it)

@blacktaxi
Copy link

Hey @kenticomartinh,

I am the lead developer for the Grammarly extension. We were excited to see that you're working on making Draft.js compatible with Grammarly! One of our goals is to make Grammarly available everywhere on the web, and we're trying to figure out the best way to do this. Please let me know if there is any way I can be of help.

@hejtmii
Copy link

hejtmii commented Oct 6, 2017

Hi @blacktaxi,

Thanks for letting me know. I am proceeding quite slowly with this, as currently this is not our top priority so I do it more in a spare time. I expect that we will focus on that more heavily in about a month or two. I am now basically doing my homework to make sure process-based delays with 3rd parties will not delay our process if we need it.

But anyway, I think mutual cooperation could be beneficial for both of us. We use Draft editor for our Cloud-based headless CMS which targets enterprise customers so if we make it work, there is also a business opportunity for you to acquire some Premium subscriptions through that.

As I wrote above I handled the first of the two major burdens, which was syncing the selection properly in case an external tool modifies the structure of the DOM nodes. I am now experimenting with MutationObserver, but given the life-cycle of React and your extension, the received changes to DOM from both React and your extension are bulked to a single list of changes, and I am not able to extract the text change made by your extension as it is already overwriten again by React DOM sync at the time of receiving Observer callback. I will look at that more closely, but so far this option seems as a dead-end option to me.

What I believe is the main problem of how your extension applies changes is what I mentioned above. It doesn't act the same way as native browser spell-check when replacing the text, as it is not firing the on(Before)Input event. This is a problem with modern editors which use object-driven model for editing rather than native contenteditable DOM. What you should ideally do instead of replacing nodes and text in DOM is making a DOM selection, and simulate regular text input that overwrites the selection. By handling this, you should be able to support many more modern editors based on frameworks which use some kind of virtual DOM for rendering such as React does.

I am not able to effectively propose changes to your extension as I can only access its minimized JS through debug. If there was some way to be able to access your browser extension source code for experiments (preferably the Chrome version), I may be able to prepare a pull request with suggested changes for you.

One another (minor) problem that I think I noticed earlier is that even if the element has data-gramm="true" attribute, your rules to disable Grammarly for specific editors are always stronger. I believe the attribute should be stronger for such check as it is an explicit indication from developer that he/she really wants it and probably knows what he/she is doing. I bypassed it for the purpose of experiment this way hejtmii@1eff16a but I don't believe that DraftJS authors would like such changes in their code base. This might be a show-stopper for the fix PR.

Let me know your thoughts

@hejtmii
Copy link

hejtmii commented Oct 20, 2017

I have made some progress with the Mutation observer prototype by altering the re-rendering conditions of the editor to not overwrite the changed made by the Grammarly extension, and it seems promising, works well at least in basic scenarios:

editsuccess

However ... I am still experiencing problems with a more complex scenario where the word is cut to multiple DOM nodes, for example in case of using various styles. Grammarly replacement removes the sub-nodes originating from React from DOM which is something that React is not expecting, and it fails trying to unmount the older version of the components that represent text nodes. That kills the editor (and whole React) consistency ...

editfail

In order to prevent this, the extension should probably not remove individual nodes when replacing text, but instead just set text of one of the nodes, and set content of other nodes to empty string. That should most likely resolve this problem. Unfortunately this is again something I am not able to effectively prototype neither I currently have idea how to bypass that from the side of the editor.

@blacktaxi any updates from your side? Have you got a chance to look at this?

@jmedwards
Copy link

jmedwards commented Oct 24, 2017

Although we do not use Draft.js, we took interest in this thread as we are facing similar problems with Glimmer 2. We're getting radio silence from Grammarly, unfortunately.

We blogged about the problem here: https://news.ycombinator.com/item?id=15541757

It would be useful to gather community thoughts and voice, and hopefully get some engagement from Grammarly.

@jmedwards
Copy link

jmedwards commented Oct 26, 2017

Grammarly released a fix which has at least solved the problems our customers were facing using our web app, which was down to a Glimmer incompatibility (and perhaps may resolved things here, for the same original incompatibility reasons?).

https://medium.com/kayako-engineering/why-we-parted-ways-with-grammarly-and-you-should-too-dea483bef823

@khpatel4991
Copy link

khpatel4991 commented Aug 30, 2019

@blacktaxi I'm not sure if this was mentioned or not before, but if you can send the corrections using window.postMessage from the extension's content script in a certain predefined format that might work for us? This might even work for whatever editor comes after draftjs...

Manually handling state is certainly the right way to go for state-based editables.
However, we are trying to make adding corrections seamless from an end user/dev's perspective on any editable without any overhead. God-forbid if API of editor changes or you decide to use another editable, that's tech debt for free and we certainly don't want more of that.

@xarg
Copy link

xarg commented Aug 30, 2019

@khpatel4991 no offense, but I’m interested in what Grammarly has to say.

@khpatel4991
Copy link

I did email @kigorw on some advice for fixing draft and he was kind enough to steer me in the right direction.

@jalners
Copy link

jalners commented Aug 30, 2019

Hi all,

There is no problem with replace of simple text inside the editor. It can be done by using native browsers API document.execCommand('insertText', false, 'text for replace'). Browsers use the similar API for replacing in native spellcheckers.

But when you replace text in different tags (e.g., part of the text is in the bold tag), editor starts acting in the strange ways.

To take a look at this behavior, please try the next steps:

  • Go to https://draftjs.org/.
  • Open the browser console.
  • Type the next text in the editor: Hello there.
  • Add bold markup for t inthere word.
  • Select there word.
  • Go to the console and execute next function: document.execCommand('insertText', false, 'all').
  • You will see the next incorrect text: allhere..
  • Place a cursor at the end of the string.
  • Press Ctrl/Command + A (Select All).
  • Enter a letter.
  • Take a look at the console. There will be an error - Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node..
  • Now editor works incorrectly for each key press.

And this happens in all browsers.

@khpatel4991
Copy link

@jalners Yes that case was certainly tricky as the bolded text node was emptied and so draft would remove it. So instead of replacing the text we can fire manual Delete keyboard events and let draft take care of it internally.

Attached screencast follows your example and some more.

https://drive.google.com/file/d/1LbuNskg22lm2JNeElnSJ84k2NdD0l2_n/view?usp=sharing

@blacktaxi
Copy link

Hi @kenticomartinh, @khpatel4991

Sorry for not responding in a while.

We have implemented support for Draft.js some time ago and used it on Twitter's new site. We didn't yet have the capacity to ship this support worldwide. I'm not sure I can answer when exactly this is going live, but it will be relatively soon.

P.S. inserting text in Draft.js works by dispatching a clipboard event. There's some trickiness around setting the selection prior to sending the event, but otherwise it's more or less straightforward.

@gbrady92
Copy link

gbrady92 commented Sep 5, 2019

Hey @blacktaxi

Is it possible to get in touch about the possibility of using the workaround for DraftJS that has been implemented for Twitter / Reddit?

We are close to completing a project that uses DraftJS as a basic text area, and a large proportion of our users use Grammarly so we are looking for a way to solve the issues discussed here.

Thanks.

@jamesandres
Copy link

Fyi for folks in this thread I've found a solution which works for our case.

Backstory: I've been working on a project to switch our main reply box at www.conversocial.com to DraftJS and stumbled upon the issue outlined in this thread. Needless to say many of our existing customers are relying on Grammarly so this was basically a roadblock on our project! 😨

I spent a day digging in to the Grammarly browser extension code and discovered that if you set the attribute data-enable-grammarly="true" on the the DraftJS div having contenteditable="true" that is enough to bypass the "disable for DraftJS" check.

ie: editor.setAttribute('data-enable-grammarly', 'true');

A word of caution, as @blacktaxi says above, Grammarly + DraftJS isn't a flawless experience; however, for our use case (basically a plain text editor) it has been acceptable.

Fyi number two, it appears that Grammarly are running different (older?) code for their Firefox and Safari extensions. Those extensions give a fairly awful experience when used with DraftJS. So we're Chrome only at the moment, sadly. @blacktaxi any word on Grammarly's non-Chrome extensions getting an update?

@blacktaxi
Copy link

Hi all,

We're currently rolling out a change that will enable Grammarly in Draft.js fields. For now, it will be limited to only a subset of Chrome users, but we plan to ramp it up in the coming days (provided there are no issues). The update for other browsers will follow sometime soon, but I can't yet give an ETA.

@steida
Copy link

steida commented Sep 12, 2019

@blacktaxi I am creating a new contentEditable editor. What should I do to support Grammarly? My implementation is less obtrusive then DraftJS, it just observes dom changes. Thank you.

@hejtmii
Copy link

hejtmii commented Sep 16, 2019

Hi guys, could you please confirm that this exact scenario works with your tools? #2171

@khpatel4991 the formatting needs to be applied only to the part of the word, not to the whole block, what you are showing always worked as far as I can tell

@blacktaxi Thank you for the update, hoping that "coming days" will be days, and not several quarters of silence as several times in the past, fingers crossed ;-)

Anyway, WProofreader people implemented PoC of a custom event which allows handling the replacement from outside by the native editor API (and prevent default behavior), and it seems to work well for us. We can even customize it any way we need which is great. You may want to consider such an option as well in case things don't go well at your side and that mentioned scenario gets problematic.

You can see it here: https://codepen.io/kentico_martinh/pen/vYBRxze

@blacktaxi
Copy link

Hi @kenticomartinh, all,

We've released support for Draft.js fields in Grammarly for Chrome for all users. Please let me know whether it works for you.

There's still at least the issue related to #638, #1082, but it doesn't seem to be like anything fixable on our side since it affects manual paste just the same. Regarding #2171, I can't reproduce the issue with the clipboard event method (but I can reproduce it with execCommand approach).

@ddruker
Copy link

ddruker commented Oct 5, 2019

@blacktaxi Thank you for focusing on this issue. Do you have details regarding HOW to implement Grammarly in draft-js and best practices?

@hejtmii
Copy link

hejtmii commented Oct 8, 2019

Hi @blacktaxi,

Thank you for the update, looks nice and seems to work in all the normal scenarios I tried so far without crashing the editor. The only problems I noticed so far (which may be applicable also to other editors) are the following:

  1. When part of the editor has contenteditable="false" (a custom rendered block), it still suggests changes to such content, see the "Simple rich text" title. I believe it shouldn't. It disappears on hover because of 2), don't worry about that part ...

  2. DraftJS has this "weird best practice" to set the editor to read-only mode when you are interacting with custom blocks Mouse interaction with custom renderer #1275 (notice how text cursor disappears temporarily while hovering over the custom block in the attached GIF)

We will probably try to stop using it because nobody seems to know how it was exactly meant, and it causes additional side problems. Anyway, I wanted to tell you because it is a valid scenario in "edit on click" scenarios.

What happens in the underlying HTML is that the editor simply turns the DIV from contenteditable to contenteditable="false". Your extension doesn't seem to pick up this change back to contenteditable, and no longer provides suggestions, until you blur and focus the editor.

  1. When I replace part of the text inside a commented (highlighted) region, it doesn't preserve the highlight, but that may be rather our concern (or concern of editor authors) than yours. I just wanted to mention it. I will check what exactly you do and how the editor picks it up (whether it fires our custom paste event, and maybe we will be able to fix it on our side)

Grammarly

@ShannonLCapper
Copy link

@blacktaxi, is it no longer possible to disable Grammarly using the data-gramm="false" attribute?

@hejtmii
Copy link

hejtmii commented Nov 1, 2019

Hi @blacktaxi,

I have some more bug reports/questions. See the attached GIF.

  1. We use a global scrollbar, and individual rich text editors automatically resize to their content, but the Grammarly button is at the very bottom of each editor, which means a lot of scrolling for the user with larger contents.

Expected behavior: The Grammarly button stays on the screen.

Is there a way to make the Grammarly button sticky to the bottom of the window, so it stays on the screen?

  1. When there are custom components in the editor (with contenteditable="false"), and you open the full-screen Grammarly view, they get converted to normal content (without the contenteditable attribute).

When you close it (even without making any replacements), the content gets broken, because it gets overwritten by the wrong content from Grammarly (which is irrelevant for any modern editor that is not pure HTML WYSIWYG editor).

Expected behavior: Any non-editable content stays preserved as it was before or the full-screen option is not available in case there are unsupported elements in the editor.

Is there a way to disable this full-screen option, or another way around it?

  1. Grammarly doesn't seem to work with DraftJS in Safari on Mac. Is that by design?

@dav-sap
Copy link

dav-sap commented Nov 4, 2019

Hey @blacktaxi, all,
I can't seem to get Grammarly to show at all now. I can see it on the basic example in the site, but when I run a basic example I don't see it. Should I use a specific version? is there a prop i need to send?
If anyone can share a code they are running that works with Grammarly I'll appreciate it.
Thanks!

@hejtmii
Copy link

hejtmii commented Nov 5, 2019

Hi @dav-sap

If by "when I run a basic example" you mean run it locally, then same here. Grammarly seems to check explicitly for localhost and doesn't start with it. You need to make your local instance accessible through a publicly looking URL to debug it (use some proxy or reconfigure hosts and the process running it).

@hejtmii
Copy link

hejtmii commented Apr 3, 2020

UPDATE: I contacted the Grammarly support with this to make sure it doesn't get forgotten here. They confirmed they are aware of the issue with the full screen, but don't have any specific time frame to fix it, and recommend to just disable it until then.

I am not entirely happy with it as the solution so I am now in the process of reverse-engineering it to find a way how to hack it to work by disabling certain parts of it via CSS. Unfortunately they are not willing to share the source code to make it easier.

I will post the solution here once we test it properly.

Mar 5, 9:28 AM PST
Thanks for getting back to us.

We don't think it's right to set expectations that may not be met due to shifting schedules. We definitely don't want to lead you to believe it will be fixed by a certain date when we're not actually sure when we'll be able to deliver a solution. However, we have forwarded your comments to our management team. We appreciate your feedback because it helps us improve Grammarly’s services.

In the meantime, you can add an attribute data-gramm="false" to your editor and Grammarly won't initialize in it.

@ghanshyam-1805
Copy link

A small update for the curious.

I've been trying to programmatically insert text into a Draft.js editor field by dispatching a clipboard 'paste' event. You would dispatch an even like than in the following manner:

function dispatchPaste(target, text) {
  const data = new DataTransfer()
  data.setData(
     // this could also be 'text/plain' -- it probably matters, but I'm not sure in which way
    'text/html',
    text
  )

  target.dispatchEvent(
    new ClipboardEvent('paste', {
      clipboardData: data,

      // need these for the event to reach Draft paste handler
      bubbles: true,
      cancelable: true
    })
  )
}

Simple enough.

However, if you want to replace a portion of text, you first need to set the selection. I found that for that to work properly, you also need to:

  1. .focus() the contenteditable element prior to setting the selection
  2. yield for one event loop iteration (i.e. setTimeout(..., 0)) before dispatching the paste event.
  3. make sure that the selection's both anchor and focus nodes are Text nodes.

№2 is not very scientific. I had some anecdotal evidence that without the yield the selection event might get handled after the paste event, but I didn't do extensive testing to confirm this 100%.

@blacktaxi It's working in Chrome but not working in Firefox, Do you have any solution for that?

@jasonwang-newsbreak
Copy link

Hi @blacktaxi,

I have some more bug reports/questions. See the attached GIF.

  1. We use a global scrollbar, and individual rich text editors automatically resize to their content, but the Grammarly button is at the very bottom of each editor, which means a lot of scrolling for the user with larger contents.

Expected behavior: The Grammarly button stays on the screen.

Is there a way to make the Grammarly button sticky to the bottom of the window, so it stays on the screen?

  1. When there are custom components in the editor (with contenteditable="false"), and you open the full-screen Grammarly view, they get converted to normal content (without the contenteditable attribute).

When you close it (even without making any replacements), the content gets broken, because it gets overwritten by the wrong content from Grammarly (which is irrelevant for any modern editor that is not pure HTML WYSIWYG editor).

Expected behavior: Any non-editable content stays preserved as it was before or the full-screen option is not available in case there are unsupported elements in the editor.

Is there a way to disable this full-screen option, or another way around it?

  1. Grammarly doesn't seem to work with DraftJS in Safari on Mac. Is that by design?

@kenticomartinh Hi, I did not get Grammarly work with DraftJS on Mac Safari, either. Have you got it work now? @blacktaxi Is there any plan of investigating it? Thanks.

@madacol
Copy link

madacol commented Feb 23, 2022

A small update for the curious.
I've been trying to programmatically insert text into a Draft.js editor field by dispatching a clipboard 'paste' event. You would dispatch an even like than in the following manner:

function dispatchPaste(target, text) {
  const data = new DataTransfer()
  data.setData(
     // this could also be 'text/plain' -- it probably matters, but I'm not sure in which way
    'text/html',
    text
  )

  target.dispatchEvent(
    new ClipboardEvent('paste', {
      clipboardData: data,

      // need these for the event to reach Draft paste handler
      bubbles: true,
      cancelable: true
    })
  )
}

Simple enough.
However, if you want to replace a portion of text, you first need to set the selection. I found that for that to work properly, you also need to:

  1. .focus() the contenteditable element prior to setting the selection
  2. yield for one event loop iteration (i.e. setTimeout(..., 0)) before dispatching the paste event.
  3. make sure that the selection's both anchor and focus nodes are Text nodes.

№2 is not very scientific. I had some anecdotal evidence that without the yield the selection event might get handled after the paste event, but I didn't do extensive testing to confirm this 100%.

@blacktaxi It's working in Chrome but not working in Firefox, Do you have any solution for that?

In Firefox, it works using properties data and dataType

const data = new DataTransfer();
data.setData(
    'text/plain',
    text
);
target.dispatchEvent(new ClipboardEvent("paste", {
    dataType: "text/plain",
    data: text,
    bubbles: true,
    clipboardData: data,
    cancelable: true
}));

I've also been able to use the beforeinput event

target.dispatchEvent(new InputEvent("beforeinput", {
    inputType: "insertText",
    data: text,
    bubbles: true,
    cancelable: true
}))

If you want to replace existing text, you have to select it first

function selectTargetText(target) {
    const selection = window.getSelection();
    const range = document.createRange();
    range.selectNodeContents(target);
    selection.removeAllRanges();
    selection.addRange(range);
}

selectTargetText(target)

// wait for selection before dispatching the `beforeinput` event
document.addEventListener("selectionchange",()=>{
    target.dispatchEvent(new InputEvent("beforeinput", {
        inputType: "insertText",
        data: text,
        bubbles: true,
        cancelable: true
    }))
},{once: true})

@sadanandl
Copy link

Hey @blacktaxi
How the Grammarly adds a global support to all inputs and shows the icon? Can you please help me to logic/thought of the global support in chrome extension.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests