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

Attempt to fix same charcter selection and replacing bug. #719

Closed

Conversation

karanjthakkar
Copy link
Contributor

@karanjthakkar karanjthakkar commented Oct 16, 2016

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
  5. 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

Fixes #398

Test Plan

[...]

@karanjthakkar karanjthakkar changed the title Attempt to fix same charcter selection and replacing bug. Fixes #398 Attempt to fix same charcter selection and replacing bug. Oct 16, 2016
@facebook-github-bot
Copy link

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!

@karanjthakkar
Copy link
Contributor Author

karanjthakkar commented Oct 16, 2016

@hellendag This is a very raw attempt at trying to fix this issue. I'm open to making any changes that would get this merged.

@facebook-github-bot
Copy link

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

@flarnie
Copy link
Contributor

flarnie commented Oct 14, 2017

Hi @karanjthakkar!

  • Sorry that this PR sat so long. It looks pretty good, thanks for making this fix!
  • I'm going to try and resolve the conflicts and merge. Might take me a couple of days to get that wrapped up.
  • I'm curious whether this bug was affecting your use of Draft.js? It seems like a pretty minor thing, which makes me curious. Still good to have it fixed though.

Copy link
Contributor

@flarnie flarnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ship it :)

corgi_shipit

flarnie and others added 2 commits October 14, 2017 16:16
**what is the change?:**
When rebasing we accidentally removed a variable and this commit adds it
back.

There was also ~5 lint errors introduced by this PR and this commit
fixes those.

**why make this change?:**
To get CI passing and make this PR mergable.

**test plan:**
`yarn lint && yarn test && flow src`
And did some manual testing.

**issue:**
Related to PR fixing facebookarchive#398
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flarnie is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flarnie has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@karanjthakkar
Copy link
Contributor Author

@flarnie Thanks for taking the time to fix up this PR and get this merged! I really appreciate it. 💯

To answer your question, no this wasn't a major bug stopping us from using draft-js. We still use it in production with the forked version.

@karanjthakkar karanjthakkar deleted the fix/same-char-insert branch October 16, 2017 17:38
facebook-github-bot pushed a commit that referenced this pull request Jan 10, 2018
Summary:
Fixes #1509.

Ref: #719
Closes #1512

Differential Revision: D6673593

fbshipit-source-id: fb5ab4c41de7958139deb125e5e8e79c76b53ec3
facebook-github-bot pushed a commit that referenced this pull request Aug 8, 2018
Summary:
Fixes #1830 (bug introduced in #719; this is a proper fix for #398).

* When we're allowing native insertion, we don't want to modify the selection because doing so blocks browser features like spellcheck from working
* In all other cases when typing, we *do* want to force the selection – failing to do this is why the original issue occurred
* We use the `insert-characters` change type for both native and non-native insertions
* Instead of guessing in `EditorState.push` whether to force a selection, accept it as a parameter
* Gate all changes by `draft_non_native_insertion_forces_selection`

I verified with the feature flag disabled (same behavior as before):

* Typing over a character works, and the cursor moves as expected (because of the `chars === currentlySelectedChars` check)
* With editor contents "ABC\ndef", replacing "d", "e", or "f" with the character above *fails* to replace the char (because that check is buggy).

And with the feature flag enabled (new behavior):

* Typing over a character still works (but does so without the buggy check)
* With editor contents "ABC\ndef", replacing "d", "e", or "f" with the character above *succeeds* at replacing the char.

Reviewed By: flarnie

Differential Revision: D9209691

fbshipit-source-id: f63551dbad689391aa9c2a69f1d6ba395b8bf1ac
midas19910709 added a commit to midas19910709/draft-js that referenced this pull request Mar 30, 2022
Summary:
_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](https://github.com/facebook/draft-js/wiki/Testing-for-Pull-Requests)
5. If you haven't already, complete the [CLA](https://code.facebook.com/cla).

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

Thanks for contributing to Draft.js!

**Summary**

Fixes #398

**Test Plan**

[...]
Closes facebookarchive/draft-js#719

Differential Revision: D6060888

fbshipit-source-id: c56fad0850a469f8f2dbb06bebad78a67750e47a
alicayan008 pushed a commit to alicayan008/draft-js that referenced this pull request Jul 4, 2023
Summary:
_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](https://github.com/facebook/draft-js/wiki/Testing-for-Pull-Requests)
5. If you haven't already, complete the [CLA](https://code.facebook.com/cla).

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

Thanks for contributing to Draft.js!

**Summary**

Fixes #398

**Test Plan**

[...]
Closes facebookarchive/draft-js#719

Differential Revision: D6060888

fbshipit-source-id: c56fad0850a469f8f2dbb06bebad78a67750e47a
aforismesen added a commit to aforismesen/draft-js that referenced this pull request Jul 12, 2024
Summary:
_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](https://github.com/facebook/draft-js/wiki/Testing-for-Pull-Requests)
5. If you haven't already, complete the [CLA](https://code.facebook.com/cla).

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

Thanks for contributing to Draft.js!

**Summary**

Fixes #398

**Test Plan**

[...]
Closes facebookarchive/draft-js#719

Differential Revision: D6060888

fbshipit-source-id: c56fad0850a469f8f2dbb06bebad78a67750e47a
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.

4 participants