🔥 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:
parent
89671a8859
commit
4f2fc11045
1 changed files with 0 additions and 31 deletions
|
|
@ -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">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue