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

Update setDraftEditorSelection.js#1203

Closed
1Jesper1 wants to merge 3 commits intofacebookarchive:masterfrom
1Jesper1:master
Closed

Update setDraftEditorSelection.js#1203
1Jesper1 wants to merge 3 commits intofacebookarchive:masterfrom
1Jesper1:master

Conversation

@1Jesper1
Copy link
Copy Markdown

Prevent getting IndexSizeError in IE11

Before submitting a pull request, please make sure the following is done...

  1. Fork the repo and create your branch from master.
  2. If you've added code that should be tested, add tests!
  3. If you've changed APIs, update the documentation.
  4. Ensure that:
  • The test suite passes (npm test)
  • Your code lints (npm run lint) and passes Flow (npm run flow)
  • You have followed the testing guidelines
  1. If you haven't already, complete the CLA.

Please use the simple form below as a guideline for describing your pull request.

Thanks for contributing to Draft.js!

Summary

[...]

Test Plan

[...]

Prevent getting IndexSizeError in IE11
@facebook-github-bot
Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

@mahlero
Copy link
Copy Markdown

mahlero commented May 12, 2017

To make this work, this line
if(selection && selection.rangeCount() > 0) {
should be changed to
if (selection && selection.rangeCount > 0) {
(rangeCount is not a method but a property)

@facebook-github-bot
Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

frederikvanhevel pushed a commit to frederikvanhevel/draft-js that referenced this pull request Jun 28, 2017
frederikvanhevel added a commit to frederikvanhevel/draft-js that referenced this pull request Jun 30, 2017
@sophiebits
Copy link
Copy Markdown
Contributor

Let's follow along on #1190 which is attempting to fix the same bug and is a little closer to a good fix I think.

@sophiebits sophiebits closed this Jul 7, 2017
@sophiebits
Copy link
Copy Markdown
Contributor

Hm, maybe this is different because it is IE? Looks similar though.

@sophiebits sophiebits reopened this Jul 7, 2017
@sophiebits
Copy link
Copy Markdown
Contributor

Can you try out the fix in #1190 and see if it fixes your issue in IE?

@rkettering
Copy link
Copy Markdown

rkettering commented Sep 29, 2017

I'd really love it if you guys could merge this PR - I'm running into this exact issue at my day job - we're trying to use DraftJS in production.

No worries, though, if #1190 actually fixes it. I'm working on an app that just has one DraftJS instance, so I'm not sure if #1190 is related.

@stasauer
Copy link
Copy Markdown

#1190 doesn't fix this problem. Please merge this PR....

@musashinm
Copy link
Copy Markdown

We've to fork Draft.js from you just to add this fix. 😞

Please, let me know if you merge this PR in the future.

@sophiebits
Copy link
Copy Markdown
Contributor

Folks seeing this bug: can you (a) verify you are on Draft 0.10.2 or newer and (b) post repro steps for producing the problem? This PR is not the correct fix but I’d like to find a proper fix to the problem you’re seeing.

@musashinm
Copy link
Copy Markdown

@sophiebits, we were using 0.10.1 and tried the last on 0.10.5... In both versions the bug freezes IE11.

@1Jesper1
Copy link
Copy Markdown
Author

Can I close this PR?

@sophiebits
Copy link
Copy Markdown
Contributor

As I said earlier, this is not the correct fix – setDraftEditorSelection should only be called in cases where .rangeCount is nonzero so if this makes a difference it means that there is an error somewhere else.

Closing this PR, but @musashinm and anyone else, please file an issue describing how to consistently reproduce this error and that will help to get it fixed.

@sophiebits sophiebits closed this Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants