From 455ef203f211c0345771527d4ee5b6bcf499ebc0 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Fri, 13 Jun 2025 23:45:22 +0200 Subject: [PATCH] Add info about additional key bindings to documentation --- docs/index.md | 9 +++++++++ shared-utils/key-helper.ts | 18 +++++++++++++++++- vite.config.mjs | 7 +++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/docs/index.md b/docs/index.md index fed1b94..ccb85ae 100644 --- a/docs/index.md +++ b/docs/index.md @@ -46,6 +46,9 @@ Available for Mac, Windows, and Linux. ⌘ + A Select all text in a note block. Press again to select the whole buffer ⌘ + ⌥ + Up/Down Add additional cursor above/below ⌥ + Shift + F Format block content (works for JSON, JavaScript, HTML, CSS and Markdown) +⌘ + ⌥ + [ Fold block(s) +⌘ + ⌥ + ] Unfold block(s) +⌘ + ⌥ + . Toggle block fold ``` **On Windows and Linux** @@ -65,7 +68,13 @@ Ctrl + Up Goto previous block Ctrl + A Select all text in a note block. Press again to select the whole buffer Ctrl + Alt + Up/Down Add additional cursor above/below Alt + Shift + F Format block content (works for JSON, JavaScript, HTML, CSS and Markdown) +Ctrl + Shift + [ Fold block(s) +Ctrl + Shift + ] Unfold block(s) +Ctrl + Shift + . Toggle block fold Alt Show menu + +You can see all the default key bindings in Heynote's settings under Key Bindings. + ``` ## Custom Key Bindings diff --git a/shared-utils/key-helper.ts b/shared-utils/key-helper.ts index a07f3f6..9866d51 100644 --- a/shared-utils/key-helper.ts +++ b/shared-utils/key-helper.ts @@ -1,4 +1,4 @@ -export const keyHelpStr = (platform: string) => { +export const keyHelpStr = (platform: string, extended: boolean = false) => { const modChar = platform === "darwin" ? "⌘" : "Ctrl" const altChar = platform === "darwin" ? "⌥" : "Alt" @@ -19,6 +19,22 @@ export const keyHelpStr = (platform: string) => { [`${altChar} + Shift + F`, "Format block content (works for JSON, JavaScript, HTML, CSS and Markdown)"], ] + if (extended) { + if (platform === "darwin") { + keyHelp.push( + [`${modChar} + ${altChar} + [`, "Fold block(s)"], + [`${modChar} + ${altChar} + ]`, "Unfold block(s)"], + [`${modChar} + ${altChar} + .`, "Toggle block fold"], + ) + } else { + keyHelp.push( + [`${modChar} + Shift + [`, "Fold block(s)"], + [`${modChar} + Shift + ]`, "Unfold block(s)"], + [`${modChar} + Shift + .`, "Toggle block fold"], + ) + } + } + if (platform === "win32" || platform === "linux") { keyHelp.push([altChar, "Show menu"]) } diff --git a/vite.config.mjs b/vite.config.mjs index bc0f884..789f85d 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -22,13 +22,16 @@ const injectKeybindsInDocs = async () => { const shortcuts = `$1**On Mac** \`\`\` -${keyHelpStr('darwin')} +${keyHelpStr('darwin', true)} \`\`\` **On Windows and Linux** \`\`\` -${keyHelpStr('win32')} +${keyHelpStr('win32', true)} + +You can see all the default key bindings in Heynote's settings under Key Bindings. + $2` const docsPath = path.resolve(__dirname, 'docs', 'index.md') let docs = fs.readFileSync(docsPath, 'utf-8')