Skip to content
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

Merged
merged 22 commits into from
Feb 8, 2017

Conversation

max-winderbaum
Copy link

@max-winderbaum max-winderbaum commented Jan 31, 2017

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

@@ -171,13 +166,8 @@ function editOnBeforeInput(editor: DraftEditor, e: SyntheticInputEvent): void {
// change the inserted text, we wait until the text is actually inserted

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.

Copy link
Author

Choose a reason for hiding this comment

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

done

@max-winderbaum
Copy link
Author

max-winderbaum commented Feb 1, 2017

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

@max-winderbaum
Copy link
Author

max-winderbaum commented Feb 1, 2017

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;

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);

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?

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.

@colinjeanne
Copy link

🚢 pending testing

@intentionally-left-nil intentionally-left-nil merged commit b8d5379 into 0.10-textio Feb 8, 2017
@intentionally-left-nil intentionally-left-nil deleted the topic-different-ie-approach branch February 8, 2017 00:50
max-winderbaum added a commit that referenced this pull request Feb 28, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants