Fix Auto Hide
This commit is contained in:
+91
-3
@@ -2,7 +2,95 @@ Index: EFB.js
|
||||
===================================================================
|
||||
--- EFB.js
|
||||
+++ EFB.js
|
||||
@@ -30209,9 +30209,9 @@
|
||||
@@ -29548,18 +29548,17 @@
|
||||
"{shift} Z X C V B N M /",
|
||||
"{space} {close}"
|
||||
]
|
||||
};
|
||||
- var Keyboard = (0, import_react4.forwardRef)(({ value, inputRef, onInput, onClose }, ref) => {
|
||||
+ var Keyboard = (0, import_react4.forwardRef)(({ value, blurRef, onInput, onClose }, ref) => {
|
||||
const [shift, setShift] = (0, import_react4.useState)(false);
|
||||
const layout = shift ? defaultLayout.shift : defaultLayout.default;
|
||||
const handleKeyPress = (key) => {
|
||||
- var _a;
|
||||
if (key === "{close}") {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
- (_a = inputRef.current) == null ? void 0 : _a.focus();
|
||||
+ blurRef.current = true;
|
||||
if (key === "{shift}") {
|
||||
setShift(!shift);
|
||||
return;
|
||||
}
|
||||
@@ -29603,12 +29602,8 @@
|
||||
"button",
|
||||
{
|
||||
className: `flex justify-center rounded-md p-4 ${key === "{close}" ? "bg-zinc-700 px-12 focus:bg-zinc-600" : "flex-1 bg-zinc-600"}`,
|
||||
onMouseDown: () => handleKeyPress(key),
|
||||
- onMouseUp: () => {
|
||||
- var _a;
|
||||
- return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
||||
- },
|
||||
children: keyIdent
|
||||
},
|
||||
`key-${rowIndex}-${keyIndex}`
|
||||
);
|
||||
@@ -29628,9 +29623,9 @@
|
||||
function Input(props) {
|
||||
const [guid] = (0, import_react5.useState)(v4_default());
|
||||
const ref = (0, import_react5.useRef)(null);
|
||||
const keyboardRef = (0, import_react5.useRef)(null);
|
||||
- const blurTimeoutRef = (0, import_react5.useRef)();
|
||||
+ const blurRef = (0, import_react5.useRef)(false);
|
||||
const [isFocused, setFocused] = (0, import_react5.useState)(false);
|
||||
const [showKeyboard, setShowKeyboard] = (0, import_react5.useState)(false);
|
||||
(0, import_react5.useEffect)(() => {
|
||||
if (simulator() === 0 /* MSFS */) {
|
||||
@@ -29660,25 +29655,23 @@
|
||||
placeholder: props.placeholder,
|
||||
disabled: props.disabled,
|
||||
onFocus: () => {
|
||||
var _a;
|
||||
- clearTimeout(blurTimeoutRef.current);
|
||||
if (!isFocused) {
|
||||
setFocused(true);
|
||||
setShowKeyboard(true);
|
||||
(_a = ref.current) == null ? void 0 : _a.select();
|
||||
}
|
||||
},
|
||||
onBlur: (e) => {
|
||||
var _a;
|
||||
- if ((_a = keyboardRef.current) == null ? void 0 : _a.contains(e.relatedTarget)) {
|
||||
- return;
|
||||
- }
|
||||
- blurTimeoutRef.current = setTimeout(() => {
|
||||
- if (props.onBlur) props.onBlur(e.target.value);
|
||||
- if (isFocused) setFocused(false);
|
||||
+ if (blurRef.current && isFocused) (_a = ref.current) == null ? void 0 : _a.focus();
|
||||
+ else {
|
||||
setShowKeyboard(false);
|
||||
- }, 100);
|
||||
+ setFocused(false);
|
||||
+ (_a = ref.current) == null ? void 0 : _a.blur();
|
||||
+ }
|
||||
+ blurRef.current = false;
|
||||
},
|
||||
onChange: (e) => {
|
||||
if (props.onChange) props.onChange(e.target.value);
|
||||
},
|
||||
@@ -29690,9 +29683,9 @@
|
||||
Keyboard_default,
|
||||
{
|
||||
ref: keyboardRef,
|
||||
value: String(props.value),
|
||||
- inputRef: ref,
|
||||
+ blurRef: blurRef,
|
||||
onInput: (value) => props.onChange && props.onChange(value),
|
||||
onClose: () => {
|
||||
var _a;
|
||||
setShowKeyboard(false);
|
||||
@@ -30209,9 +30202,9 @@
|
||||
{
|
||||
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
||||
"data-ripple-light": "true",
|
||||
@@ -13,7 +101,7 @@ Index: EFB.js
|
||||
) }) })
|
||||
] }) }) });
|
||||
}
|
||||
@@ -40562,8 +40562,13 @@
|
||||
@@ -40562,8 +40555,13 @@
|
||||
] })
|
||||
] }) }) });
|
||||
}
|
||||
@@ -27,7 +115,7 @@ Index: EFB.js
|
||||
init_common();
|
||||
var import_jsx_runtime15 = __toESM(require_jsx_runtime());
|
||||
var routes = {
|
||||
@@ -40578,9 +40583,9 @@
|
||||
@@ -40578,9 +40576,9 @@
|
||||
button: {
|
||||
title: "Payload",
|
||||
icon: Weight
|
||||
|
||||
Reference in New Issue
Block a user