Add info about additional key bindings to documentation

This commit is contained in:
Jonatan Heyman 2025-06-13 23:45:22 +02:00
parent 215ad942ff
commit 455ef203f2
3 changed files with 31 additions and 3 deletions

View File

@ -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 ⌘ + A Select all text in a note block. Press again to select the whole buffer
⌘ + ⌥ + Up/Down Add additional cursor above/below ⌘ + ⌥ + Up/Down Add additional cursor above/below
⌥ + Shift + F Format block content (works for JSON, JavaScript, HTML, CSS and Markdown) ⌥ + 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** **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 + A Select all text in a note block. Press again to select the whole buffer
Ctrl + Alt + Up/Down Add additional cursor above/below Ctrl + Alt + Up/Down Add additional cursor above/below
Alt + Shift + F Format block content (works for JSON, JavaScript, HTML, CSS and Markdown) 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 Alt Show menu
You can see all the default key bindings in Heynote's settings under Key Bindings.
``` ```
## Custom Key Bindings ## Custom Key Bindings

View File

@ -1,4 +1,4 @@
export const keyHelpStr = (platform: string) => { export const keyHelpStr = (platform: string, extended: boolean = false) => {
const modChar = platform === "darwin" ? "⌘" : "Ctrl" const modChar = platform === "darwin" ? "⌘" : "Ctrl"
const altChar = platform === "darwin" ? "⌥" : "Alt" 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)"], [`${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") { if (platform === "win32" || platform === "linux") {
keyHelp.push([altChar, "Show menu"]) keyHelp.push([altChar, "Show menu"])
} }

View File

@ -22,13 +22,16 @@ const injectKeybindsInDocs = async () => {
const shortcuts = `$1**On Mac** const shortcuts = `$1**On Mac**
\`\`\` \`\`\`
${keyHelpStr('darwin')} ${keyHelpStr('darwin', true)}
\`\`\` \`\`\`
**On Windows and Linux** **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` $2`
const docsPath = path.resolve(__dirname, 'docs', 'index.md') const docsPath = path.resolve(__dirname, 'docs', 'index.md')
let docs = fs.readFileSync(docsPath, 'utf-8') let docs = fs.readFileSync(docsPath, 'utf-8')