in src/component/utils/getDefaultKeyBinding.js [61:114]
function getDefaultKeyBinding(
e: SyntheticKeyboardEvent<>,
): ?DraftEditorCommand {
switch (e.keyCode) {
case 66: // B
return hasCommandModifier(e) ? 'bold' : null;
case 68: // D
return isCtrlKeyCommand(e) ? 'delete' : null;
case 72: // H
return isCtrlKeyCommand(e) ? 'backspace' : null;
case 73: // I
return hasCommandModifier(e) ? 'italic' : null;
case 74: // J
return hasCommandModifier(e) ? 'code' : null;
case 75: // K
return isOSX && isCtrlKeyCommand(e) ? 'secondary-cut' : null;
case 77: // M
return isCtrlKeyCommand(e) ? 'split-block' : null;
case 79: // O
return isCtrlKeyCommand(e) ? 'split-block' : null;
case 84: // T
return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null;
case 85: // U
return hasCommandModifier(e) ? 'underline' : null;
case 87: // W
return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;
case 88: // X
return hasCommandModifier(e) && e.shiftKey ? 'strikethrough' : null;
case 89: // Y
if (isCtrlKeyCommand(e)) {
return isOSX ? 'secondary-paste' : 'redo';
}
return null;
case 90: // Z
return getZCommand(e) || null;
case Keys.RETURN:
return 'split-block';
case Keys.DELETE:
return getDeleteCommand(e);
case Keys.BACKSPACE:
return getBackspaceCommand(e);
// LEFT/RIGHT handlers serve as a workaround for a Firefox bug.
case Keys.LEFT:
return shouldFixFirefoxMovement && hasCommandModifier(e)
? 'move-selection-to-start-of-block'
: null;
case Keys.RIGHT:
return shouldFixFirefoxMovement && hasCommandModifier(e)
? 'move-selection-to-end-of-block'
: null;
default:
return null;
}
}