fix: use flex layout for terminal container to ensure proper sizing
- Remove ResizeObserver that was causing infinite resize loop - Add display: flex to terminal-container for proper child sizing - Use flex: 1 on .xterm element instead of height: 100% - Remove explicit height/width from xterm-viewport and xterm-screen - Let flexbox handle the layout naturally
This commit is contained in:
@@ -227,14 +227,6 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
|
|
||||||
window.addEventListener("resize", handleResize);
|
window.addEventListener("resize", handleResize);
|
||||||
|
|
||||||
// Use ResizeObserver to detect container size changes
|
|
||||||
const resizeObserver = new ResizeObserver(() => {
|
|
||||||
handleResize();
|
|
||||||
});
|
|
||||||
if (terminalRef.current) {
|
|
||||||
resizeObserver.observe(terminalRef.current);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify parent about terminal readiness
|
// Notify parent about terminal readiness
|
||||||
if (onTerminalReadyRef.current) {
|
if (onTerminalReadyRef.current) {
|
||||||
const sendData = (data: string) => {
|
const sendData = (data: string) => {
|
||||||
@@ -263,7 +255,6 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
return () => {
|
return () => {
|
||||||
clearTimeout(resizeTimeout);
|
clearTimeout(resizeTimeout);
|
||||||
window.removeEventListener("resize", handleResize);
|
window.removeEventListener("resize", handleResize);
|
||||||
resizeObserver.disconnect();
|
|
||||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
||||||
ws.close();
|
ws.close();
|
||||||
term.dispose();
|
term.dispose();
|
||||||
|
|||||||
@@ -2592,24 +2592,19 @@ a.nav-item,
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding: var(--space-2);
|
padding: var(--space-2);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal-container .xterm {
|
.terminal-container .xterm {
|
||||||
height: 100%;
|
flex: 1;
|
||||||
width: 100%;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal-container .xterm-viewport {
|
.terminal-container .xterm-viewport {
|
||||||
height: 100% !important;
|
|
||||||
width: 100% !important;
|
|
||||||
background: #1e1e1e !important;
|
background: #1e1e1e !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal-container .xterm-screen {
|
|
||||||
height: 100% !important;
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-container canvas {
|
.terminal-container canvas {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user