Skip to content

Commit

Permalink
Update list of key shortcuts for the help modal
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Aug 9, 2018
1 parent b74b0f5 commit faf4976
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 14 deletions.
29 changes: 24 additions & 5 deletions edit-post/components/keyboard-shortcut-help-modal/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import { displayShortcutList } from '@wordpress/keycodes';
import { __ } from '@wordpress/i18n';

const {
// Cmd+<key> on a mac, Ctrl+<key> elsewhere
primary,
// Shift+Cmd+<key> on a mac, Ctrl+Shift+<key> elsewhere
primaryShift,
// Shift+Alt+Cmd+<key> on a mac, Ctrl+Shift+Akt+<key> elsewhere
secondary,
// Ctrl+Alt+<key> on a mac, Shift+Alt+<key> elsewhere
access,
ctrl,
ctrlShift,
shiftAlt,
} = displayShortcutList;

const globalShortcuts = {
Expand All @@ -34,6 +41,22 @@ const globalShortcuts = {
keyCombination: primaryShift( ',' ),
description: __( 'Show or hide the settings sidebar.' ),
},
{
keyCombination: ctrl( '`' ),
description: __( 'Navigate to a the next part of the editor.' ),
},
{
keyCombination: ctrlShift( '`' ),
description: __( 'Navigate to the previous part of the editor.' ),
},
{
keyCombination: shiftAlt( 'n' ),
description: __( 'Navigate to a the next part of the editor (alternative).' ),
},
{
keyCombination: shiftAlt( 'p' ),
description: __( 'Navigate to the previous part of the editor (alternative).' ),
},
{
keyCombination: secondary( 'm' ),
description: __( 'Switch between Visual Editor and Code Editor.' ),
Expand All @@ -46,7 +69,7 @@ const selectionShortcuts = {
shortcuts: [
{
keyCombination: primary( 'a' ),
description: __( 'Select all text if typing, otherwise select all blocks.' ),
description: __( 'Select all text when typing. Press again to select all blocks.' ),
},
{
keyCombination: 'Esc',
Expand All @@ -58,10 +81,6 @@ const selectionShortcuts = {
const blockShortcuts = {
title: __( 'Block shortcuts' ),
shortcuts: [
{
keyCombination: primary( 'del' ),
description: __( 'Delete the selected block(s).' ),
},
{
keyCombination: primaryShift( 'd' ),
description: __( 'Duplicate the selected block(s).' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,44 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
",",
],
},
Object {
"description": "Navigate to a the next part of the editor.",
"keyCombination": Array [
"Ctrl",
"+",
"\`",
],
},
Object {
"description": "Navigate to the previous part of the editor.",
"keyCombination": Array [
"Ctrl",
"+",
"Shift",
"+",
"\`",
],
},
Object {
"description": "Navigate to a the next part of the editor (alternative).",
"keyCombination": Array [
"Shift",
"+",
"Alt",
"+",
"N",
],
},
Object {
"description": "Navigate to the previous part of the editor (alternative).",
"keyCombination": Array [
"Shift",
"+",
"Alt",
"+",
"P",
],
},
Object {
"description": "Switch between Visual Editor and Code Editor.",
"keyCombination": Array [
Expand All @@ -93,7 +131,7 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
shortcuts={
Array [
Object {
"description": "Select all text if typing, otherwise select all blocks.",
"description": "Select all text when typing. Press again to select all blocks.",
"keyCombination": Array [
"Ctrl",
"+",
Expand All @@ -112,14 +150,6 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
key="2"
shortcuts={
Array [
Object {
"description": "Delete the selected block(s).",
"keyCombination": Array [
"Ctrl",
"+",
"Del",
],
},
Object {
"description": "Duplicate the selected block(s).",
"keyCombination": Array [
Expand Down
4 changes: 4 additions & 0 deletions packages/keycodes/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const modifiers = {
primaryShift: ( _isMac ) => _isMac() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],
secondary: ( _isMac ) => _isMac() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],
access: ( _isMac ) => _isMac() ? [ CTRL, ALT ] : [ SHIFT, ALT ],
ctrl: () => [ CTRL ],
ctrlShift: () => [ CTRL, SHIFT ],
shift: () => [ SHIFT ],
shiftAlt: () => [ SHIFT, ALT ],
};

/**
Expand Down

0 comments on commit faf4976

Please sign in to comment.