mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-25 19:56:29 +00:00
Amended some default styling/befavior
- cursorBlink is not default from now on - added some custom behavior in the demo
This commit is contained in:
parent
0ae4b803cf
commit
7a6fb27a53
22
demo/main.js
22
demo/main.js
@ -1,8 +1,24 @@
|
|||||||
var terminalContainer = document.getElementById('terminal-container'),
|
var terminalContainer = document.getElementById('terminal-container'),
|
||||||
term = new Terminal({geometry: [60, 37]});
|
term = new Terminal({geometry: [95, 37]});
|
||||||
|
|
||||||
|
term.prompt = function () {
|
||||||
|
term.write('> ');
|
||||||
|
}
|
||||||
|
|
||||||
term.open(terminalContainer);
|
term.open(terminalContainer);
|
||||||
|
term.writeln('Welcome to xterm.js');
|
||||||
|
term.writeln('Just type some keys in the prompt below.');
|
||||||
|
term.writeln('');
|
||||||
|
term.prompt();
|
||||||
|
|
||||||
term.on('data', function (data) {
|
term.on('key', function (key, ev) {
|
||||||
term.write(data);
|
console.log(this, key, ev);
|
||||||
|
if (ev.keyIdentifier == 'Enter') {
|
||||||
|
term.writeln('');
|
||||||
|
term.prompt();
|
||||||
|
} if (ev.keyCode == 8) {
|
||||||
|
term.write('\b \b');
|
||||||
|
}else {
|
||||||
|
term.write(key);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
@ -12,9 +12,15 @@ h1 {
|
|||||||
width: 960px;
|
width: 960px;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#terminal-container .terminal {
|
#terminal-container .terminal {
|
||||||
background-color: #111;
|
background-color: #111;
|
||||||
color: #fafafa;
|
color: #fafafa;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#terminal-container .terminal .terminal-cursor {
|
||||||
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
@ -40,4 +40,8 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
outline: none;
|
outline: none;
|
||||||
font-family: courier-new, courier, monospace;
|
font-family: courier-new, courier, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.terminal .terminal-cursor {
|
||||||
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ Terminal.defaults = {
|
|||||||
convertEol: false,
|
convertEol: false,
|
||||||
termName: 'xterm',
|
termName: 'xterm',
|
||||||
geometry: [80, 24],
|
geometry: [80, 24],
|
||||||
cursorBlink: true,
|
cursorBlink: false,
|
||||||
visualBell: false,
|
visualBell: false,
|
||||||
popOnBell: false,
|
popOnBell: false,
|
||||||
scrollback: 1000,
|
scrollback: 1000,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user