Skip to content

Commit

Permalink
fix keypress
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeparticle committed Oct 28, 2023
1 parent 2c7f098 commit 4a9c795
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ui/src/pages/Generator/Image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
7 changes: 5 additions & 2 deletions ui/src/pages/Markdown/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions ui/src/pages/Markdown/TableOfContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4a9c795

Please sign in to comment.