Cleanup unused stuff

This commit is contained in:
Jared Palmer 2023-06-02 14:32:46 -04:00
parent 01527d450b
commit 9f4ef62961
9 changed files with 13 additions and 558 deletions

View file

@ -1,10 +0,0 @@
import { isAppleDevice } from "@/lib/tinykeys";
/**
* Uses the Meta key on macOS, and the Ctrl key on other platforms.
*/
export const isModifierPressed = (
event: KeyboardEvent | React.KeyboardEvent
): boolean => {
return isAppleDevice() ? event.metaKey : event.ctrlKey;
};

View file

@ -1,6 +1,5 @@
import type { RefObject } from "react";
import { useRef } from "react";
import { isModifierPressed } from "./is-modifier-pressed";
export function useCmdEnterSubmit(): {
formRef: RefObject<HTMLFormElement>;
@ -11,8 +10,7 @@ export function useCmdEnterSubmit(): {
const handleKeyDown = (
event: React.KeyboardEvent<HTMLTextAreaElement>
): void => {
// Capture `⌘`|Ctrl + Enter
if (isModifierPressed(event) && event.key === "Enter") {
if (event.key === "Enter") {
formRef.current?.requestSubmit();
}
};