CompositionInput: Prevent ctrl+shift+m from adding a newline

This commit is contained in:
Scott Nonnenberg 2019-11-14 18:12:54 -08:00
parent 5750412fda
commit 01bf53776b

View file

@ -651,6 +651,7 @@ export const CompositionInput = ({
);
const editorKeybindingFn = React.useCallback(
// tslint:disable-next-line cyclomatic-complexity
(e: React.KeyboardEvent): CompositionInputEditorCommand | null => {
if (e.key === 'Enter' && emojiResults.length > 0) {
e.preventDefault();
@ -692,6 +693,13 @@ export const CompositionInput = ({
}
}
// Get rid of Ctrl-Shift-M, which by default adds a newline
if ((e.key === 'm' || e.key === 'M') && e.shiftKey && e.ctrlKey) {
e.preventDefault();
return null;
}
return getDefaultKeyBinding(e);
},
[emojiResults, large]