From 4a9c795b536d05154d92ef6688bd3d5523653c50 Mon Sep 17 00:00:00 2001 From: lifeparticle Date: Sat, 28 Oct 2023 15:35:13 +1100 Subject: [PATCH] fix keypress --- ui/src/pages/Generator/Image/index.tsx | 4 ++-- ui/src/pages/Markdown/Editor/index.tsx | 7 +++++-- ui/src/pages/Markdown/TableOfContent/index.tsx | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ui/src/pages/Generator/Image/index.tsx b/ui/src/pages/Generator/Image/index.tsx index 5ad40a6c..f94f6be6 100644 --- a/ui/src/pages/Generator/Image/index.tsx +++ b/ui/src/pages/Generator/Image/index.tsx @@ -28,12 +28,12 @@ const ImageGeneratorFromColors: React.FC = () => { useCombinedKeyPress( () => onTextAreaChange("#FF0000, #00FFFF, #FFFFFF, #C0C0C0, #000000"), - ["Meta", "KeyE"] + ["control/meta", "e"] ); useCombinedKeyPress(() => { onTextAreaChange(""); - }, ["Meta", "KeyR"]); + }, ["control/meta", "r"]); const onTextAreaChange = (value: string) => { setColors(extractColors(value)); diff --git a/ui/src/pages/Markdown/Editor/index.tsx b/ui/src/pages/Markdown/Editor/index.tsx index eecfd125..668408f5 100644 --- a/ui/src/pages/Markdown/Editor/index.tsx +++ b/ui/src/pages/Markdown/Editor/index.tsx @@ -17,8 +17,11 @@ const MarkdownEditor: React.FC = () => { const { isDarkMode } = useMode(); - useCombinedKeyPress(() => setMarkdown("# Hello, World!"), ["Meta", "KeyE"]); - useCombinedKeyPress(() => setMarkdown(""), ["Meta", "KeyR"]); + useCombinedKeyPress( + () => setMarkdown("# Hello, World!"), + ["control/meta", "e"] + ); + useCombinedKeyPress(() => setMarkdown(""), ["control/meta", "r"]); const IS_MARKDOWN_EMPTY = markdown.length === 0; diff --git a/ui/src/pages/Markdown/TableOfContent/index.tsx b/ui/src/pages/Markdown/TableOfContent/index.tsx index d4253e7f..88223267 100644 --- a/ui/src/pages/Markdown/TableOfContent/index.tsx +++ b/ui/src/pages/Markdown/TableOfContent/index.tsx @@ -23,13 +23,14 @@ const TableOfContent: React.FC = () => { fetchData( "https://raw.githubusercontent.com/lifeparticle/JS-Cheatsheet/main/README.md" ), - ["Meta", "KeyE"] + ["control/meta", "e"] ); + useCombinedKeyPress(() => { setUrl(""); setMarkdown(""); setTableOfContents(""); - }, ["Meta", "KeyR"]); + }, ["control/meta", "r"]); const onMarkdownChange = (text: string) => { setMarkdown(text);