Change key binding for format code

This commit is contained in:
Jonatan Heyman 2023-03-03 13:28:36 +01:00
parent 03d0195eb3
commit 85a5bc95a7
2 changed files with 4 additions and 29 deletions

View File

@ -1,6 +1,7 @@
import { isMac } from "./detect-platform.js"
const modChar = isMac ? "⌘" : "Ctrl"
const altChar = isMac ? "⌥" : "Alt "
export const initialContent = `
text
@ -13,7 +14,7 @@ Welcome to Heynote!
[${modChar} + Up] Goto previous block
[${modChar} + A] Select all text in a note block. Press again to select the whole scratchpad
[${modChar} + + Up/Down]  Add additional cursor above/below
[${modChar} + B]  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)
math
This is a Math block. Here, rows are evaluated as math expressions.
@ -30,33 +31,7 @@ time * 2
text-a
`
export const initialDevContent = `
text-a
Welcome to Heynote!
[${modChar} + Enter] Add new block and move cursor to it
[${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 scratchpad
[${modChar} + + Up/Down]  Add additional cursor above/below
[${modChar} + B]  Format block content (works for JSON, JavaScript, HTML, CSS and Markdown)
math
This is a Math block. Here, rows are evaluated as math expressions.
length = 10
radius = 5
volume = length * radius^2 * PI
sqrt(9)
It also supports some basic unit conversions:
13 inches in cm
time = 3900 seconds to minutes
time * 2
text-a
export const initialDevContent = initialContent + `
python-a
# hmm
def my_func():

View File

@ -56,7 +56,7 @@ export function heynoteKeymap(editor) {
["Alt-ArrowUp", moveLineUp],
["Alt-ArrowDown", moveLineDown],
["Mod-l", () => editor.openLanguageSelector()],
["Mod-b", formatBlockContent],
["Alt-Shift-f", formatBlockContent],
{key:"Mod-ArrowUp", run:gotoPreviousBlock, shift:selectPreviousBlock},
{key:"Mod-ArrowDown", run:gotoNextBlock, shift:selectNextBlock},
{key:"Ctrl-ArrowUp", run:gotoPreviousParagraph, shift:selectPreviousParagraph},