fix(TGUI): Reverts changes to modal.js

Modal.js had a VOREStation-specific change to allow it to handle text input/the enter key.
This was removed in commit ( https://github.com/VOREStation/VOREStation/commit/4b7873210ab17ae404c7d8a2432764e92df27d66 )

This change reverts that change, re-adding the logic for enter/keydown.

Fixes ( https://github.com/VOREStation/VOREStation/issues/14982 )
This commit is contained in:
Runa Dacino
2023-06-21 11:52:38 +02:00
parent a5a04920b5
commit 040ba1c3a5
2 changed files with 14 additions and 3 deletions
+13 -2
View File
@@ -9,9 +9,20 @@ import { computeBoxClassName, computeBoxProps } from './Box';
import { Dimmer } from './Dimmer';
export const Modal = (props) => {
const { className, children, ...rest } = props;
const { className, children, onEnter, ...rest } = props;
// VOREStation Addition start
let handleKeyDown;
if (onEnter) {
handleKeyDown = (e) => {
let key = e.which || e.keyCode;
if (key === 13) {
onEnter(e);
}
};
}
// VOREStation Addition end
return (
<Dimmer>
<Dimmer onKeyDown={handleKeyDown} /* VOREStation edit */>
<div
className={classes(['Modal', className, computeBoxClassName(rest)])}
{...computeBoxProps(rest)}>
File diff suppressed because one or more lines are too long