macOS shortcuts: Only listen for command key, not control key

This commit is contained in:
Scott Nonnenberg 2019-12-17 10:52:36 -08:00 committed by Ken Powers
parent d86e8ef7ec
commit 2c7baad68d
10 changed files with 59 additions and 39 deletions

View file

@ -653,6 +653,9 @@ export const CompositionInput = ({
const editorKeybindingFn = React.useCallback(
// tslint:disable-next-line cyclomatic-complexity
(e: React.KeyboardEvent): CompositionInputEditorCommand | null => {
const commandKey = get(window, 'platform') === 'darwin' && e.metaKey;
const controlKey = get(window, 'platform') !== 'darwin' && e.ctrlKey;
if (e.key === 'Enter' && emojiResults.length > 0) {
e.preventDefault();
@ -660,7 +663,7 @@ export const CompositionInput = ({
}
if (e.key === 'Enter' && !e.shiftKey) {
if (large && !(e.ctrlKey || e.metaKey)) {
if (large && !(controlKey || commandKey)) {
return getDefaultKeyBinding(e);
}