languagetool-browser-addon icon indicating copy to clipboard operation
languagetool-browser-addon copied to clipboard

editing fails on facebook.com after correction is applied

Open danielnaber opened this issue 8 years ago • 4 comments

Write a post with errors, open LT, select a suggested correction -> the correction is applied but editing stops working, at least the backspace key is not functional anymore.

danielnaber avatar Aug 23 '16 11:08 danielnaber

The problem seems to be elem[elemValue] = Markup.markupList2html(markupList); in replaceIn(): maybe Facebook has some listeners on its contentenditable=true div that get confused when the complete text gets replaced.

danielnaber avatar Aug 23 '16 12:08 danielnaber

If you press the backspace key long enough, it will again show the "What's on your mind" placeholder text, as if the text is empty. The text just won't get updated/deleted.

So it's most likely a Facebook element/key listener. I'll have a look at it later as I also have a Chrome extension specific to Facebook which raised a lot of this kind of issues in the past: https://www.facebook.com/FBTranslate/ FB can be a b*tch. :wink:

oliverschloebe avatar Aug 24 '16 07:08 oliverschloebe

I wondered if it might help to simulate key presses (to delete errors and insert the correction) instead of replacing the whole text. Unfortunately, the focus is in the popup, so that won't help either.

danielnaber avatar Aug 24 '16 07:08 danielnaber

The problem isn't in the "some Facebook listeners on its contentenditable=true" element.

Facebook written on React, and this post form is a react component which has own state, render function, etc (I'm not an expert in React). You can't just rewrite innerHTML of this element, I guess you need wrote script which will mutating react component.

Here is question similar to your's: http://stackoverflow.com/questions/36825895/chrome-extension-mutating-running-react-application

I found extension which do resolved this issue, but it's complicated to understand source code, because it was minified: https://chrome.google.com/webstore/detail/grammarly-for-chrome/kbfnbcaeplbcioakkpcpgfkobkghlhen

Alex-Golovin avatar Feb 01 '17 17:02 Alex-Golovin