mirror of
https://github.com/heyman/heynote.git
synced 2025-06-21 01:57:46 +02:00
Fix keyboard shortcut help text in the initial buffer text
This commit is contained in:
parent
9ee25ab758
commit
d1ea17c197
@ -1,21 +1,31 @@
|
|||||||
import { isLinux, isMac, isWindows } from "./detect-platform.js"
|
import { isLinux, isMac, isWindows } from "./detect-platform.js"
|
||||||
|
|
||||||
const modChar = isMac ? "⌘" : "Ctrl"
|
const modChar = isMac ? "⌘" : "Ctrl"
|
||||||
const altChar = isMac ? "⌥" : "Alt "
|
const altChar = isMac ? "⌥" : "Alt"
|
||||||
const showMenuHelp = (isWindows || isLinux) ? `\n${altChar} Show menu` : ""
|
|
||||||
|
const keyHelp = [
|
||||||
|
[`${modChar} + Enter`, "Add new block below the current block"],
|
||||||
|
[`${modChar} + Shift + Enter`, "Split the current block at cursor position"],
|
||||||
|
[`${modChar} + L`, "Change block language"],
|
||||||
|
[`${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 (isWindows || isLinux) {
|
||||||
|
keyHelp.push([altChar, "Show menu"])
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyMaxLength = keyHelp.map(([key, help]) => key.length).reduce((a, b) => Math.max(a, b))
|
||||||
|
const keyHelpStr = keyHelp.map(([key, help]) => `${key.padEnd(keyMaxLength)} ${help}`).join("\n")
|
||||||
|
|
||||||
|
|
||||||
export const initialContent = `
|
export const initialContent = `
|
||||||
∞∞∞text
|
∞∞∞text
|
||||||
Welcome to Heynote! 👋
|
Welcome to Heynote! 👋
|
||||||
|
|
||||||
${modChar} + Enter Add new block below the current block
|
${keyHelpStr}
|
||||||
${modChar} + Shift + Enter Split the current block at cursor position
|
|
||||||
${modChar} + L Change block language (Math, Markdown, etc.)
|
|
||||||
${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} + ⌥ + Up/Down Add additional cursor above/below
|
|
||||||
${altChar} + Shift + F Format block content (works for JSON, JavaScript, HTML, CSS and Markdown)${showMenuHelp}
|
|
||||||
∞∞∞math
|
∞∞∞math
|
||||||
This is a Math block. Here, rows are evaluated as math expressions.
|
This is a Math block. Here, rows are evaluated as math expressions.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user