-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Attempt to fix same charcter selection and replacing bug. #719
Attempt to fix same charcter selection and replacing bug. #719
Conversation
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! |
@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. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Hi @karanjthakkar!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**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
There was a problem hiding this 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.
There was a problem hiding this 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.
@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. |
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
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
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
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
Before submitting a pull request, please make sure the following is done...
master
.npm test
)npm run lint
) and passes Flow (npm run flow
)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
[...]