This commit is contained in:
ACoolName 2024-06-02 21:49:06 +03:00
parent 7d200d3023
commit a3bb166d70

View File

@ -267,12 +267,22 @@ export function ActionItem(p: { action: ActionInfo, identifierSubstring?: string
function createTerminal(websocket: string){ function createTerminal(websocket: string){
const NewWindow = window.open('', '', 'width=800 height=600')! const NewWindow = window.open('', '', 'width=800 height=600')!
NewWindow.document.write('<div id="root" width="100%" height="100%"/>') NewWindow.document.write(`<!doctype html>
<html>
const root = ReactDOM.createRoot( <head>
NewWindow.document.getElementById('root') as HTMLElement <link rel="stylesheet" href="node_modules/@xterm/xterm/css/xterm.css" />
); <script src="node_modules/@xterm/xterm/lib/xterm.js"></script>
root.render(<Box sx={terminalModalStyle}><TerminalComponent websocket={websocket}/></Box>) </head>
<body>
<div id="terminal"></div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
</script>
</body>
</html>
`)
} }
return (<> return (<>