-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
64 lines (64 loc) · 1.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!doctype html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
.container {
display: flex;
height: 100vh;
flex-direction: column;
}
.menubar {
background-color: #1e88e5;
}
.editor {
flex-grow: 1;
background-color: #212121;
color: #fafafa;
}
.center {
text-align: center;
}
.statusbar {
background-color: #388e3c;
}
</style>
<link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
<script src="node_modules/xterm/lib/xterm.js"></script>
<script src="node_modules/xterm-addon-fit/lib/xterm-addon-fit.js"></script>
</head>
<body>
<div class="container">
<div class="menubar">
<div class="center">xterm.js-example</div>
</div>
<div class="editor">Main editor</div>
<div id="terminal"></div>
<div class="statusbar">
<div class="center">status bar</div>
</div>
</div>
<script>
// Use `rows` to define terminal height. If you use the CSS style height,
// there may be some space not filled. (if the space cannot fit one more row)
var term = new Terminal({"rows": 10});
var fitAddon = new FitAddon.FitAddon();
term.loadAddon(fitAddon);
term.open(document.getElementById('terminal'));
fitAddon.fit();
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m \r\n$ ')
term.onKey(e => {
term.write(e.key);
if (e.key == '\r')
term.write('\n$ ');
})
window.onresize = () => {
// The fitAddon is necessary for window resize
fitAddon.fit();
};
</script>
</body>
</html>