diff --git a/packages/edit-navigation/src/components/navigation-editor/shortcuts.js b/packages/edit-navigation/src/components/navigation-editor/shortcuts.js index 02a76d70b6c4a..d75d3f176e2e4 100644 --- a/packages/edit-navigation/src/components/navigation-editor/shortcuts.js +++ b/packages/edit-navigation/src/components/navigation-editor/shortcuts.js @@ -18,6 +18,25 @@ function NavigationEditorShortcuts( { saveBlocks } ) { } ); + const { redo, undo } = useDispatch( 'core' ); + useShortcut( + 'core/edit-navigation/undo', + ( event ) => { + undo(); + event.preventDefault(); + }, + { bindGlobal: true } + ); + + useShortcut( + 'core/edit-navigation/redo', + ( event ) => { + redo(); + event.preventDefault(); + }, + { bindGlobal: true } + ); + return null; } @@ -33,6 +52,24 @@ function RegisterNavigationEditorShortcuts() { character: 's', }, } ); + registerShortcut( { + name: 'core/edit-navigation/undo', + category: 'global', + description: __( 'Undo your last changes.' ), + keyCombination: { + modifier: 'primary', + character: 'z', + }, + } ); + registerShortcut( { + name: 'core/edit-navigation/redo', + category: 'global', + description: __( 'Redo your last undo.' ), + keyCombination: { + modifier: 'primaryShift', + character: 'z', + }, + } ); }, [ registerShortcut ] ); return null;