chatbot-template/lib/hooks/is-modifier-pressed.tsx

11 lines
282 B
TypeScript
Raw Normal View History

2023-05-19 12:33:56 -04:00
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;
};