From b32f54d925ae04795947eaa99dca8a6506541cf3 Mon Sep 17 00:00:00 2001 From: taconi <44283700+taconi@users.noreply.github.com> Date: Sun, 26 Jan 2025 09:41:36 -0300 Subject: [PATCH] feat(web): Add `Cmd/Ctrl-Alt-H` alias to hide editor (#330) `Ctrl-Shift-H` does not work as it is a Firefox shortcut, so this adds `Ctrl-Alt-H` as an alternative. --- README.md | 30 ++++++++++++++--------------- packages/web/src/routes/session.tsx | 9 ++++++--- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 13e80772..1d4bc8f2 100644 --- a/README.md +++ b/README.md @@ -29,21 +29,21 @@ Web-based P2P collaborative editor for live coding music and graphics *Some keybindings may differ depending on the language/target you choose, and the operating system* -| Keybinding | Function | -| ------------------------- | ------------------------------------ | -| `alt/option` `enter` | Evaluate all | -| `ctrl/cmd` `enter` | Evaluate block, Evaluate selection | -| `shift` `enter` | Evaluate line | -| `ctrl/cmd/option/alt` `.` | Silence (output depends on language) | -| `cmd/ctrl` `shift` `h` | Show/Hide editor panels | -| `cmd/ctrl` `x` | Cut selected text | -| `cmd/ctrl` `c` | Copy selected text | -| `cmd/ctrl` `v` | Paste cut/copied text | -| `cmd/ctrl` `z/u` | Undo edit | -| `cmd/ctrl` `shift` `z/u` | Redo edit | -| `cmd/ctrl` `}` | add indentation | -| `cmd/ctrl` `{` | remove indentation | -| `cmd/ctrl` `f` | search and replace | +| Keybinding | Function | +| -------------------------- | ------------------------------------ | +| `alt/option` `enter` | Evaluate all | +| `ctrl/cmd` `enter` | Evaluate block, Evaluate selection | +| `shift` `enter` | Evaluate line | +| `ctrl/cmd/option/alt` `.` | Silence (output depends on language) | +| `cmd/ctrl` `shift/alt` `h` | Show/Hide editor panels | +| `cmd/ctrl` `x` | Cut selected text | +| `cmd/ctrl` `c` | Copy selected text | +| `cmd/ctrl` `v` | Paste cut/copied text | +| `cmd/ctrl` `z/u` | Undo edit | +| `cmd/ctrl` `shift` `z/u` | Redo edit | +| `cmd/ctrl` `}` | add indentation | +| `cmd/ctrl` `{` | remove indentation | +| `cmd/ctrl` `f` | search and replace | *On Mac:* diff --git a/packages/web/src/routes/session.tsx b/packages/web/src/routes/session.tsx index f404c21f..bc1d03c4 100644 --- a/packages/web/src/routes/session.tsx +++ b/packages/web/src/routes/session.tsx @@ -474,9 +474,12 @@ export function Component() { }, [documents, ...editorRefs], ); - useShortcut(["Meta-Shift-H", "Control-Shift-H"], () => { - setHidden((p) => !p); - }); + useShortcut( + ["Meta-Shift-H", "Control-Shift-H", "Meta-Alt-H", "Control-Alt-H"], + () => { + setHidden((p) => !p); + }, + ); useShortcut(["Control-,", "Meta-,"], () => { setMessagesPanelExpanded((v) => !v); });