🔥 refactor(App.tsx): remove unused code related to preventing control+backspace event

The code related to preventing the control+backspace event in the application was removed as it was no longer needed.
This commit is contained in:
Cristhian Zanforlin Lousa 2023-08-02 11:52:33 -03:00
commit 4f2fc11045

View file

@ -122,37 +122,6 @@ export default function App() {
};
//Prevent the control+backspace event on the application
const onKeyDownRef = useRef(false);
useEffect(() => {
const handleKeyDownCapture = (event) => {
if(event.key === "Backspace" && event.ctrlKey === true) {
event.preventDefault();
event.stopPropagation();
}
onKeyDownRef.current = true;
};
const handleKeyUpCapture = (event) => {
if (onKeyDownRef.current) {
if(event.key === "Backspace" && event.ctrlKey === true) {
event.preventDefault();
event.stopPropagation();
}
onKeyDownRef.current = false;
}
};
document.addEventListener('keydown', handleKeyDownCapture, true);
document.addEventListener('keyup', handleKeyUpCapture, true);
return () => {
document.removeEventListener('keydown', handleKeyDownCapture, true);
document.removeEventListener('keyup', handleKeyUpCapture, true);
};
}, []);
return (
//need parent component with width and height
<div className="flex h-full flex-col">