Fix ctrl-m shortcut for Windows and shift-del shortcut for Linux

This commit is contained in:
Ken Powers 2019-08-14 13:32:38 -04:00 committed by Scott Nonnenberg
parent 1c5450122f
commit 3946b5aec6

View file

@ -16,7 +16,7 @@ import {
} from 'draft-js';
import Measure, { ContentRect } from 'react-measure';
import { Manager, Popper, Reference } from 'react-popper';
import { head, noop, trimEnd } from 'lodash';
import { get, head, noop, trimEnd } from 'lodash';
import classNames from 'classnames';
import emojiRegex from 'emoji-regex';
import { Emoji } from './emoji/Emoji';
@ -548,6 +548,18 @@ export const CompositionInput = ({
return 'prev-emoji';
}
// Get rid of default draft.js ctrl-m binding which interferes with Windows minimize
if (e.key === 'm' && e.ctrlKey) {
return null;
}
if (get(window, 'platform') === 'linux') {
// Get rid of default draft.js shift-del binding which interferes with Linux cut
if (e.key === 'Delete' && e.shiftKey) {
return null;
}
}
return getDefaultKeyBinding(e);
},
[emojiResults]