mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 04:43:36 +00:00
Allow Escape to close link confirmation (#1014)
This commit is contained in:
@@ -223,6 +223,20 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
|||||||
url: string;
|
url: string;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!linkClickDialog) return;
|
||||||
|
|
||||||
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
|
if (event.key !== "Escape") return;
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
setLinkClickDialog(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("keydown", handleKeyDown, true);
|
||||||
|
return () => window.removeEventListener("keydown", handleKeyDown, true);
|
||||||
|
}, [linkClickDialog]);
|
||||||
|
|
||||||
const [tmuxSessionPicker, setTmuxSessionPicker] = useState<{
|
const [tmuxSessionPicker, setTmuxSessionPicker] = useState<{
|
||||||
sessions: Array<{
|
sessions: Array<{
|
||||||
name: string;
|
name: string;
|
||||||
@@ -3092,10 +3106,12 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
|||||||
<div
|
<div
|
||||||
className="fixed inset-0 flex items-center justify-center z-[10000]"
|
className="fixed inset-0 flex items-center justify-center z-[10000]"
|
||||||
style={{ backgroundColor: "rgba(0,0,0,0.5)" }}
|
style={{ backgroundColor: "rgba(0,0,0,0.5)" }}
|
||||||
|
onClick={() => setLinkClickDialog(null)}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="flex flex-col gap-3 p-4 rounded shadow-lg max-w-sm w-full mx-4"
|
className="flex flex-col gap-3 p-4 rounded shadow-lg max-w-sm w-full mx-4"
|
||||||
style={{ backgroundColor }}
|
style={{ backgroundColor }}
|
||||||
|
onClick={(event) => event.stopPropagation()}
|
||||||
>
|
>
|
||||||
<p className="text-xs font-bold uppercase tracking-widest text-muted-foreground">
|
<p className="text-xs font-bold uppercase tracking-widest text-muted-foreground">
|
||||||
{t("terminal.linkDialogTitle")}
|
{t("terminal.linkDialogTitle")}
|
||||||
|
|||||||
Reference in New Issue
Block a user