From ac9254d04967d11b32e41483f162f81ce443d669 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Wed, 10 Dec 2025 22:48:07 +0100 Subject: [PATCH] Update script-terminal-modal.tsx --- AppImage/components/script-terminal-modal.tsx | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/AppImage/components/script-terminal-modal.tsx b/AppImage/components/script-terminal-modal.tsx index b2cc1e6..da42c2d 100644 --- a/AppImage/components/script-terminal-modal.tsx +++ b/AppImage/components/script-terminal-modal.tsx @@ -64,7 +64,7 @@ export function ScriptTerminalModal({ const [isWaitingNextInteraction, setIsWaitingNextInteraction] = useState(false) const waitingTimeoutRef = useRef(null) - const [modalHeight, setModalHeight] = useState(600) + const [modalHeight, setModalHeight] = useState(80) // Cambiado de 600px a 80vh const [isResizing, setIsResizing] = useState(false) const resizeHandlersRef = useRef<{ handleMouseMove: ((e: MouseEvent) => void) | null @@ -416,13 +416,15 @@ export function ScriptTerminalModal({ e.preventDefault() e.stopPropagation() + setIsResizing(true) const startY = "touches" in e ? e.touches[0].clientY : e.clientY const startHeight = modalHeight const handleMove = (moveEvent: MouseEvent | TouchEvent) => { const currentY = "touches" in moveEvent ? moveEvent.touches[0].clientY : moveEvent.clientY const deltaY = currentY - startY - const newHeight = Math.max(300, Math.min(2400, startHeight + deltaY)) + const deltaPercent = (deltaY / window.innerHeight) * 100 + const newHeight = Math.max(50, Math.min(95, startHeight + deltaPercent)) setModalHeight(newHeight) @@ -443,9 +445,26 @@ export function ScriptTerminalModal({ } const handleEnd = () => { + setIsResizing(false) + + if (fitAddonRef.current && termRef.current && wsRef.current?.readyState === WebSocket.OPEN) { + setTimeout(() => { + if (fitAddonRef.current && termRef.current) { + fitAddonRef.current.fit() + wsRef.current?.send( + JSON.stringify({ + type: "resize", + cols: termRef.current.cols, + rows: termRef.current.rows, + }), + ) + } + }, 50) + } + document.removeEventListener("mousemove", handleMove as any) document.removeEventListener("mouseup", handleEnd) - document.removeEventListener("touchmove", handleMove as any) + document.removeEventListener("touchmove", handleMove as any, { passive: false } as any) document.removeEventListener("touchend", handleEnd) localStorage.setItem("scriptModalHeight", modalHeight.toString()) @@ -468,9 +487,10 @@ export function ScriptTerminalModal({ e.preventDefault()} onEscapeKeyDown={(e) => e.preventDefault()} + hideClose > {title} @@ -494,8 +514,23 @@ export function ScriptTerminalModal({ )} + {!isMobile && ( +
+ +
+ )} + {(isMobile || isTablet) && ( -
+
)} - {(isTablet || (!isMobile && !isTablet)) && ( -
- -
- )} -