logbox close on escape now

This commit is contained in:
Olivier Gagnon 2021-08-23 01:15:20 -04:00
parent 0b3c114cd0
commit b148b2f0b5
2 changed files with 21 additions and 0 deletions

@ -112,6 +112,13 @@
background-color: #000;
}
.log-box-button:hover,
.log-box-button:focus {
color: var(--my-font-color);
text-decoration: none;
cursor: pointer;
}
.dialog-box-content {
z-index: 2;
background-color: var(--my-background-color);

@ -48,6 +48,20 @@ function ScriptLogPopup(props: IProps): React.ReactElement {
removeElementById(props.id);
}
useEffect(() => {
function closeHandler(event: KeyboardEvent) {
if(event.keyCode === 27) {
close();
}
}
document.addEventListener('keydown', closeHandler);
return () => {
document.removeEventListener('keydown', closeHandler);
}
}, []);
function kill(): void {
killWorkerScript(props.script, props.script.server, true);
close();