From 81578f7925490c14284f102726ac87d54ab738a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Myrland?= Date: Tue, 12 Oct 2021 18:46:15 +0200 Subject: [PATCH] Extends shortcut for opening & closing the studio - Should support alt + \ in most cases - Corrects the shortcut in log message when the studio is hidden --- theatre/studio/src/UIRoot/UIRoot.tsx | 2 +- theatre/studio/src/UIRoot/useKeyboardShortcuts.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/theatre/studio/src/UIRoot/UIRoot.tsx b/theatre/studio/src/UIRoot/UIRoot.tsx index 900af9a..3c74630 100644 --- a/theatre/studio/src/UIRoot/UIRoot.tsx +++ b/theatre/studio/src/UIRoot/UIRoot.tsx @@ -71,7 +71,7 @@ export default function UIRoot() { useEffect(() => { if (visiblityState === 'everythingIsHidden') { console.warn( - `Theatre Studio is hidden. You can restore it by either hitting alt/option+\` or calling studio.ui.restore()`, + `Theatre Studio is hidden. Use the keyboard shortcut 'alt + \\' to restore the studio, or call studio.ui.restore().`, ) } return () => {} diff --git a/theatre/studio/src/UIRoot/useKeyboardShortcuts.ts b/theatre/studio/src/UIRoot/useKeyboardShortcuts.ts index dd76484..6b06c14 100644 --- a/theatre/studio/src/UIRoot/useKeyboardShortcuts.ts +++ b/theatre/studio/src/UIRoot/useKeyboardShortcuts.ts @@ -44,7 +44,12 @@ export default function useKeyboardShortcuts() { } else { return } - } else if (e.key === `'` && e.altKey) { + } + // alt + \ + else if ( + e.altKey && + (e.key === '\\' || e.code === 'Backslash' || e.code === 'IntlBackslash') + ) { studio.transaction(({stateEditors, drafts}) => { stateEditors.studio.ahistoric.setVisibilityState( drafts.ahistoric.visibilityState === 'everythingIsHidden'