heynote/shared-utils/key-helper.ts
Jonatan Heyman c010df083c WIP: Multiple notes support
Add support for migrating old buffer file to new library.

Add support for changing location for the notes library.

Replace theme toggle in status bar with a dropdown in Appearance settings.

Improve New Note and Update Note dialogs.

Implement UI for confirming note delete (the actualal deltion is still to be implemented).
2024-09-10 13:34:23 +02:00

27 lines
1.4 KiB
TypeScript

export const keyHelpStr = (platform: string) => {
const modChar = platform === "darwin" ? "⌘" : "Ctrl"
const altChar = platform === "darwin" ? "⌥" : "Alt"
const keyHelp = [
[`${modChar} + Enter`, "Add new block below the current block"],
[`${altChar} + Enter`, "Add new block before the current block"],
[`${modChar} + Shift + Enter`, "Add new block at the end of the buffer"],
[`${altChar} + Shift + Enter`, "Add new block at the start of the buffer"],
[`${modChar} + ${altChar} + Enter`, "Split the current block at cursor position"],
[`${modChar} + L`, "Change block language"],
[`${modChar} + S`, "Create a new note from the current block"],
[`${modChar} + P`, "Open note selector"],
[`${modChar} + Down`, "Goto next block"],
[`${modChar} + Up`, "Goto previous block"],
[`${modChar} + A`, "Select all text in a note block. Press again to select the whole buffer"],
[`${modChar} + ${altChar} + Up/Down`, "Add additional cursor above/below"],
[`${altChar} + Shift + F`, "Format block content (works for JSON, JavaScript, HTML, CSS and Markdown)"],
]
if (platform === "win32" || platform === "linux") {
keyHelp.push([altChar, "Show menu"])
}
const keyMaxLength = keyHelp.map(([key]) => key.length).reduce((a, b) => Math.max(a, b))
return keyHelp.map(([key, help]) => `${key.padEnd(keyMaxLength)} ${help}`).join("\n")
}