Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change keyboard shortcuts to platform safe #1858

Merged
merged 6 commits into from
Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/ui/src/libs/key_events.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-fallthrough */
import keycode from 'keycode';

export const features = {
Expand Down Expand Up @@ -40,9 +41,13 @@ export default function handle(e) {
case keycode('F'):
e.preventDefault();
return features.FULLSCREEN;
case keycode('C'):
// backward-compatibility
case keycode('D'):
e.preventDefault();
return features.ADDON_PANEL;
case keycode('X'):
// backward-compatibility
case keycode('L'):
e.preventDefault();
return features.STORIES_PANEL;
Expand All @@ -52,9 +57,13 @@ export default function handle(e) {
case keycode('left'):
e.preventDefault();
return features.PREV_STORY;
case keycode('O'):
// backward-compatibility
case keycode('P'):
e.preventDefault();
return features.SHOW_SEARCH;
case keycode('G'):
// backward-compatibility
case keycode('J'):
e.preventDefault();
return features.ADDON_PANEL_IN_RIGHT;
Expand Down
16 changes: 8 additions & 8 deletions lib/ui/src/modules/ui/components/shortcuts_help.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ export function getShortcuts(platform) {
// if it is mac platform
if (platform && platform.indexOf('mac') !== -1) {
return [
{ name: 'Show Search Box', keys: ['⌘ ⇧ P', '⌃ ⇧ P'] },
{ name: 'Toggle Addon panel position', keys: ['⌘ ⇧ J', '⌃ ⇧ J'] },
{ name: 'Show Search Box', keys: ['⌘ ⇧ O', '⌃ ⇧ O'] },
{ name: 'Toggle Addon panel position', keys: ['⌘ ⇧ G', '⌃ ⇧ G'] },
{ name: 'Toggle Fullscreen Mode', keys: ['⌘ ⇧ F', '⌃ ⇧ F'] },
{ name: 'Toggle Stories Panel', keys: ['⌘ ⇧ L', '⌃ ⇧ L'] },
{ name: 'Toggle Addon panel', keys: ['⌘ ⇧ D', '⌃ ⇧ D'] },
{ name: 'Toggle Stories Panel', keys: ['⌘ ⇧ X', '⌃ ⇧ X'] },
{ name: 'Toggle Addon panel', keys: ['⌘ ⇧ C', '⌃ ⇧ C'] },
{ name: 'Next Story', keys: ['⌘ ⇧ →', '⌃ ⇧ →'] },
{ name: 'Previous Story', keys: ['⌘ ⇧ ←', '⌃ ⇧ ←'] },
];
}

return [
{ name: 'Show Search Box', keys: ['Ctrl + Shift + P'] },
{ name: 'Toggle Addon panel position', keys: ['Ctrl + Shift + J'] },
{ name: 'Show Search Box', keys: ['Ctrl + Shift + O'] },
{ name: 'Toggle Addon panel position', keys: ['Ctrl + Shift + G'] },
{ name: 'Toggle Fullscreen Mode', keys: ['Ctrl + Shift + F'] },
{ name: 'Toggle Stories Panel', keys: ['Ctrl + Shift + L'] },
{ name: 'Toggle Addon panel', keys: ['Ctrl + Shift + D'] },
{ name: 'Toggle Stories Panel', keys: ['Ctrl + Shift + X'] },
{ name: 'Toggle Addon panel', keys: ['Ctrl + Shift + C'] },
{ name: 'Next Story', keys: ['Ctrl + Shift + →'] },
{ name: 'Previous Story', keys: ['Ctrl + Shift + ←'] },
];
Expand Down