question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Editing a field creates a new object with Grammarly

See original GitHub issue

When editing an existing field, a new value object is created. A simple fix to this is to make minor changes to the index.js file. At line 454, replace

let jsonField = json.embed.fields[Array.from(fields.children).indexOf(field)];

with

let jsonField = json.embed.fields[Array.from(fields.children).indexOf(field)-2];

Source: Invalid array index

Edit: -2 isn’t a permanent / efficient fix, the extension was messing up with the textarea

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
Glitchiicommented, Jul 7, 2021

I have just made a new commit 33a798cc44062611ddf1d7f6cf2ee0cc3e3cb68d which allows it to work with the extension. Grammarly adds a new element named grammarly-extension, All I had to do is to filter out only the elements with the class ‘field’ which all field elements should have by replacing this line.

let jsonField = json.embed.fields[Array.from(fields.children).indexOf(field)];

with this.

let jsonField = json.embed.fields[Array.from(fields.children).filter(e => e.className === 'field').indexOf(field)];

Alternatively, it should work if I only filtered divs, since Grammarly elements are named grammarly-extension.

1reaction
Glitchiicommented, Jul 5, 2021

I cannot seem to replicate this problem. Works fine when I edit an existing field. In fact, removing 2 from an element’s index doesn’t work properly (and probably shouldn’t), it results to the first two fields getting ignored and not changed on the embed when edited since you are removing 2 from the index.

Which is why it’s confusing how you got to this problem in the first place, unless you edited the script before and might have changed something that caused this on your end. If not, what are the steps to get to this problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing the Text Editor SDK - Grammarly Support
The SDK lets you easily add and configure the Grammarly Text Editor Plugin. In text fields and editors that use the plugin, your...
Read more >
Inline editing of text area fields with Grammarly - DataTables
Hi I noticed that if using Grammarly with an inline editor using a textarea based plugin, choosing a spelling or grammar correction using ......
Read more >
Use Grammarly with Overleaf - Overleaf, Online LaTeX Editor
If you see only a two-way toggle or if you choose Source (legacy), it's the previous Ace-based editor which is incompatible with the...
Read more >
How to add Grammarly to Google Docs - EditorNinja
Grammarly is the leader in grammar editing software and works amazingly in ... Log into your Grammarly account or create a new account....
Read more >
Conflict with Grammarly chrome extension · Issue #616 - GitHub
@blacktaxi I am creating a new contentEditable editor. ... We've released support for Draft.js fields in Grammarly for Chrome for all users.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found