mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
escape key closes data window
This commit is contained in:
@@ -205,6 +205,21 @@ const DashboardDevices: FC = () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const escFunction = useCallback((event) => {
|
||||||
|
if (event.keyCode === 27) {
|
||||||
|
if (device_select) {
|
||||||
|
device_select.fns.onRemoveAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
document.addEventListener('keydown', escFunction);
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('keydown', escFunction);
|
||||||
|
};
|
||||||
|
}, [escFunction]);
|
||||||
|
|
||||||
const fetchCoreData = useCallback(async () => {
|
const fetchCoreData = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
setSelectedDevice(undefined);
|
setSelectedDevice(undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user