ignore keydown events while doing IME composition
This commit is contained in:
parent
4d151722ff
commit
9f47fad305
3 changed files with 8 additions and 0 deletions
|
@ -177,6 +177,8 @@ export default class BasicMessageEditor extends React.Component {
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shouldIgnoreKeyDownEvents() {
|
||||||
|
return this._isIMEComposing;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPaste = (event) => {
|
_onPaste = (event) => {
|
||||||
|
|
|
@ -127,6 +127,9 @@ export default class EditMessageComposer extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onKeyDown = (event) => {
|
_onKeyDown = (event) => {
|
||||||
|
if (this._editorRef.shouldIgnoreKeyDownEvents()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.metaKey || event.altKey || event.shiftKey) {
|
if (event.metaKey || event.altKey || event.shiftKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,9 @@ export default class SendMessageComposer extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
_onKeyDown = (event) => {
|
_onKeyDown = (event) => {
|
||||||
|
if (this._editorRef.shouldIgnoreKeyDownEvents()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const hasModifier = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
const hasModifier = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
||||||
if (event.key === "Enter" && !hasModifier) {
|
if (event.key === "Enter" && !hasModifier) {
|
||||||
this._sendMessage();
|
this._sendMessage();
|
||||||
|
|
Loading…
Reference in a new issue