Skip to content
Merged
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
12 changes: 10 additions & 2 deletions packages/rich-text/src/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ class RichText extends Component {
// (CJK), do not trigger a change if characters are being composed.
// Browsers setting `isComposing` to `true` will usually emit a final
// `input` event when the characters are composed.
if ( event && event.nativeEvent.isComposing ) {
if (
event &&
event.nativeEvent &&
event.nativeEvent.isComposing
) {
// Also don't update any selection.
document.removeEventListener( 'selectionchange', this.onSelectionChange );
return;
Expand All @@ -335,6 +339,10 @@ class RichText extends Component {
let inputType;

if ( event ) {
inputType = event.inputType;
}

if ( ! inputType ) {
inputType = event.nativeEvent.inputType;
}

Expand Down Expand Up @@ -401,7 +409,7 @@ class RichText extends Component {
onCompositionEnd() {
// Ensure the value is up-to-date for browsers that don't emit a final
// input event after composition.
this.onInput();
this.onInput( { inputType: 'insertText' } );
// Tracking selection changes can be resumed.
document.addEventListener( 'selectionchange', this.onSelectionChange );
}
Expand Down