diff --git a/lib/components/content.js b/lib/components/content.js index 0a3d344c7..d586fccc9 100644 --- a/lib/components/content.js +++ b/lib/components/content.js @@ -58,6 +58,7 @@ class Content extends React.Component { constructor(props) { super(props) this.tmp = {} + this.tmp.compositions = 0 this.forces = 0 } @@ -148,6 +149,7 @@ class Content extends React.Component { onCompositionStart = (e) => { this.tmp.isComposing = true + this.tmp.compositions++ } /** @@ -160,8 +162,13 @@ class Content extends React.Component { onCompositionEnd = (e) => { this.forces++ + const count = this.tmp.compositions + // The `count` check here ensures that if another composition starts + // before the timeout has closed out this one, we will abort unsetting the + // `isComposing` flag, since a composition in still in affect. setTimeout(() => { + if (this.tmp.compositions > count) return this.tmp.isComposing = false }) } @@ -267,7 +274,6 @@ class Content extends React.Component { return } - if ( (key == 'enter') || (key == 'backspace') ||