mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-05 18:18:51 +01:00
Revert "⌨️ feat: Add Shift-Key Shortcuts for Instant Conversation Actions (#10732)"
This reverts commit 41c0a96d39.
This commit is contained in:
parent
dcd9273700
commit
03ced7a894
4 changed files with 43 additions and 176 deletions
|
|
@ -1,2 +1 @@
|
|||
export * from './useLazyEffect';
|
||||
export { default as useShiftKey } from './useShiftKey';
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
import { useState, useEffect } from 'react';
|
||||
|
||||
/**
|
||||
* Hook to track whether the shift key is currently being held down
|
||||
* @returns boolean indicating if shift key is pressed
|
||||
*/
|
||||
export default function useShiftKey(): boolean {
|
||||
const [isShiftHeld, setIsShiftHeld] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Shift') {
|
||||
setIsShiftHeld(true);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyUp = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Shift') {
|
||||
setIsShiftHeld(false);
|
||||
}
|
||||
};
|
||||
|
||||
// Reset shift state when window loses focus
|
||||
const handleBlur = () => {
|
||||
setIsShiftHeld(false);
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
window.addEventListener('keyup', handleKeyUp);
|
||||
window.addEventListener('blur', handleBlur);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleKeyDown);
|
||||
window.removeEventListener('keyup', handleKeyUp);
|
||||
window.removeEventListener('blur', handleBlur);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return isShiftHeld;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue