-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update editor immediately for native insertion events #24
Update editor immediately for native insertion events #24
Conversation
@@ -171,13 +166,8 @@ function editOnBeforeInput(editor: DraftEditor, e: SyntheticInputEvent): void { | |||
// change the inserted text, we wait until the text is actually inserted |
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.
Make sure to update this comment since it's no longer accurate.
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.
done
There's one other problem I've noticed, and that's that in IE editor._usingNativeRendering will just set true and never flip. I don't think there is any performance problem with this, it just is worth mentioning. EDIT: this problem is resolved as of f6fc6ff |
A third problem is that autocorrect changes are broken because they don't get to fall through editOnInput. This is not a change from the old way of doing things though - it's just another problem to solve. EDIT: this problem is resolved as of f6fc6ff |
// event. See editOnBeforeInput() for more info | ||
if (editor._waitingOnInput) { | ||
if (!editor._renderNativeContent) { | ||
return; |
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's the reason for not clearing _waitingOnInput
here?
|
||
if (isIE) { | ||
setImmediate(() => { | ||
editOnInput(editor); |
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.
One of the major differences between my fix and flarnie's fix was that mine called editOnInput
and hers didn't. Mine also caused https://github.com/textioHQ/editor/issues/582.
Have we validated that this doesn't regress 582? If it doesn't, why doesn't it?
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.
It looks like I can repro seeing the caret lag behind where typing occurs for documents with a lot of highlights. This is fairly difficult to get a repro of and the typing experience in this case is so slow that the caret is the least of my worries.
🚢 pending testing |
Fixes textioHQ/frontend#2259 This is an alternative method to getting around the problem of IE11 having no input event and wanting to allow native browser insertion to increase react performance See also: facebook#667 See also: facebook#871 The premise of this is that it updates the editor state immediately, on the onBeforeInput event. And then it adds extra flags to know what to do during the render. As opposed to waiting for the input event on IE.
Fixes https://github.com/textioHQ/frontend/issues/2259
This is an alternative method to getting around the problem of IE11 having no input event and wanting to allow native browser insertion to increase react performance
See also: facebookarchive#667
See also: facebookarchive#871