File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33< head >
44 < link rel ="stylesheet " href ="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css " />
55 < script src ="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js "> </ script >
6+ < script src ="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js "> </ script >
67</ head >
7- < body style ="margin: 0; padding: 20px; background: #1e1e1e; ">
8- < div id ="terminal "> </ div >
8+ < body style ="margin: 0; padding: 20px; background: #1e1e1e; height: 100vh; box-sizing: border-box; ">
9+ < div id ="terminal " style =" height: 100%; " > </ div >
910
1011 < script >
1112 // Create terminal with responsive font size
1213 const term = new Terminal ( {
1314 fontSize : window . innerWidth < 768 ? 14 : 16
1415 } ) ;
16+
17+ // Fit addon
18+ const fitAddon = new FitAddon . FitAddon ( ) ;
19+ term . loadAddon ( fitAddon ) ;
20+
1521 term . open ( document . getElementById ( 'terminal' ) ) ;
22+ fitAddon . fit ( ) ;
23+
24+ // Handle window resize
25+ window . addEventListener ( 'resize' , ( ) => {
26+ fitAddon . fit ( ) ;
27+ } ) ;
1628
1729 // Create worker code inline
1830 const workerCode = `
You can’t perform that action at this time.
0 commit comments