Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit f6fbf1c

Browse files
Thomas Nardonefacebook-github-bot
Thomas Nardone
authored andcommitted
Fix Linux keyboard shortcuts
Summary: Removing the concept of "isWindows", as that seemed to land Linux into a forgotten bucket. IMO the shortcuts should simply be split between Mac and PC. Reviewed By: sophiebits Differential Revision: D6777189 fbshipit-source-id: 9c596c4c544298f0ac46470988ed2992698e0dca
1 parent 93bc209 commit f6fbf1c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/component/utils/getDefaultKeyBinding.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ var Keys = require('Keys');
2020
var UserAgent = require('UserAgent');
2121

2222
var isOSX = UserAgent.isPlatform('Mac OS X');
23-
var isWindows = UserAgent.isPlatform('Windows');
2423

2524
// Firefox on OSX had a bug resulting in navigation instead of cursor movement.
2625
// This bug was fixed in Firefox 29. Feature detection is virtually impossible
@@ -44,8 +43,8 @@ function getZCommand(e: SyntheticKeyboardEvent<>): ?DraftEditorCommand {
4443
}
4544

4645
function getDeleteCommand(e: SyntheticKeyboardEvent<>): ?DraftEditorCommand {
47-
// Allow default "cut" behavior for Windows on Shift + Delete.
48-
if (isWindows && e.shiftKey) {
46+
// Allow default "cut" behavior for PCs on Shift + Delete.
47+
if (!isOSX && e.shiftKey) {
4948
return null;
5049
}
5150
return shouldRemoveWord(e) ? 'delete-word' : 'delete';
@@ -76,7 +75,7 @@ function getDefaultKeyBinding(
7675
case 74: // J
7776
return hasCommandModifier(e) ? 'code' : null;
7877
case 75: // K
79-
return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null;
78+
return isOSX && isCtrlKeyCommand(e) ? 'secondary-cut' : null;
8079
case 77: // M
8180
return isCtrlKeyCommand(e) ? 'split-block' : null;
8281
case 79: // O
@@ -89,7 +88,7 @@ function getDefaultKeyBinding(
8988
return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null;
9089
case 89: // Y
9190
if (isCtrlKeyCommand(e)) {
92-
return isWindows ? 'redo' : 'secondary-paste';
91+
return isOSX ? 'secondary-paste' : 'redo';
9392
}
9493
return null;
9594
case 90: // Z

0 commit comments

Comments
 (0)