This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unlucky failures in character replacement
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
- Loading branch information