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

[RN Mobile] RichText: Return early when content has changed in onSelectionChangeFromAztec #41682

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For each user feature we should also add a importance categorization label to i

- [*] Add 'Insert from URL' option to Video block [#41493]
- [*] Image block copies the alt text from the media library when selecting an item [#41839]
- [**] RichText - Improve performance by dropping events during quick typing [#41682]

## 1.78.1

Expand Down
9 changes: 9 additions & 0 deletions packages/rich-text/src/component/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,15 @@ export class RichText extends Component {
return;
}

// Check for and discard events during quick typing. Updating the selection during quick typing isn't
// necessary and can cause UI lags. (see https://github.com/WordPress/gutenberg/pull/41682.)
if (
contentWithoutRootTag !== this.value &&
this.lastAztecEventType === 'selection change'
) {
return;
}

this.comesFromAztec = true;
this.firedAfterTextChanged = true; // Selection change event always fires after the fact.

Expand Down