Too many bugs in composition mode
Author: szrenweiCreated Nov 19, 2020Updated Oct 27, 2022
Do you want to request a feature or report a bug?
bug
What is the current behavior?
- Input some chars use IME, then command + z to undo the chars, it will not work
- Input two line text, select them all, use IME to input some chars, the second line would not be removed
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: https://jsfiddle.net/gmertk/e61z7nfa/.
Just go to the official site to try: https://draftjs.org/
What is the expected behavior?
- undo should work when input use IME
- use IME should replace all selected lines
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
version >= 0.11.0 all have these problems, I notice that you have changed the composition handler, that is the cause of these bugs.
like this: https://github.com/facebook/draft-js/blob/master/src/component/handlers/composition/DraftEditorCompositionHandler.js#L256, the author must be
drunk when he write the code, EditorState.push has push the same contentState, this line of code just useless.
Source: facebookarchive/draft-js