diff --git a/app/components/CodeEditor.tsx b/app/components/CodeEditor.tsx index c843bb15..b20ecb25 100644 --- a/app/components/CodeEditor.tsx +++ b/app/components/CodeEditor.tsx @@ -10,6 +10,7 @@ import { useJsonDoc } from "~/hooks/useJsonDoc"; import { getEditorSetup } from "~/utilities/codeMirrorSetup"; import { darkTheme, lightTheme } from "~/utilities/codeMirrorTheme"; import { useTheme } from "./ThemeProvider"; +import { useHotkeys } from "react-hotkeys-hook"; export type CodeEditorProps = { content: string; @@ -98,6 +99,16 @@ export function CodeEditor(opts: CodeEditorProps) { const { minimal } = useJsonDoc(); + useHotkeys( + "ctrl+a,meta+a,command+a", + (e) => { + e.preventDefault(); + view?.dispatch({ selection: { anchor: 0, head: state?.doc.length } }); + }, + [view, state] + ); + + return (