fix: improve terminal sizing with delayed fit and flex layout
- Use double requestAnimationFrame before initial fitAddon.fit() to ensure DOM is settled - Add display: flex to mobile-terminal-content for proper child sizing - Add width: 100% to terminal-wrapper.mobile - Ensure terminal fills parent container both horizontally and vertically
This commit is contained in:
@@ -163,11 +163,17 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
||||
term.loadAddon(new WebLinksAddon());
|
||||
|
||||
term.open(terminalRef.current);
|
||||
fitAddon.fit();
|
||||
|
||||
// Connect WebSocket
|
||||
const ws = connectWebSocket();
|
||||
|
||||
// Fit after layout settles - use rAF to ensure DOM is ready
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
fitAddon.fit();
|
||||
});
|
||||
});
|
||||
|
||||
// Handle terminal input
|
||||
term.onData((data) => {
|
||||
if (ws.readyState !== WebSocket.OPEN) return;
|
||||
|
||||
Reference in New Issue
Block a user