mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-04 13:45:28 +00:00
Add find to demo
This commit is contained in:
parent
2564592c09
commit
c13b86a885
@ -16,6 +16,13 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>xterm.js: xterm, in the browser</h1>
|
<h1>xterm.js: xterm, in the browser</h1>
|
||||||
<div id="terminal-container"></div>
|
<div id="terminal-container"></div>
|
||||||
|
<div>
|
||||||
|
<h2>Actions</h2>
|
||||||
|
<p>
|
||||||
|
<label>Find next <input id="find-next"/></label>
|
||||||
|
<label>Find previous <input id="find-previous"/></label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2>Options</h2>
|
<h2>Options</h2>
|
||||||
<p>
|
<p>
|
||||||
|
17
demo/main.js
17
demo/main.js
@ -7,6 +7,10 @@ var term,
|
|||||||
charHeight;
|
charHeight;
|
||||||
|
|
||||||
var terminalContainer = document.getElementById('terminal-container'),
|
var terminalContainer = document.getElementById('terminal-container'),
|
||||||
|
actionElements = {
|
||||||
|
findNext: document.querySelector('#find-next'),
|
||||||
|
findPrevious: document.querySelector('#find-previous')
|
||||||
|
},
|
||||||
optionElements = {
|
optionElements = {
|
||||||
cursorBlink: document.querySelector('#option-cursor-blink'),
|
cursorBlink: document.querySelector('#option-cursor-blink'),
|
||||||
cursorStyle: document.querySelector('#option-cursor-style'),
|
cursorStyle: document.querySelector('#option-cursor-style'),
|
||||||
@ -30,6 +34,19 @@ function setTerminalSize () {
|
|||||||
colsElement.addEventListener('change', setTerminalSize);
|
colsElement.addEventListener('change', setTerminalSize);
|
||||||
rowsElement.addEventListener('change', setTerminalSize);
|
rowsElement.addEventListener('change', setTerminalSize);
|
||||||
|
|
||||||
|
actionElements.findNext.addEventListener('keypress', function (e) {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
e.preventDefault();
|
||||||
|
term.findNext(actionElements.findNext.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
actionElements.findPrevious.addEventListener('keypress', function (e) {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
e.preventDefault();
|
||||||
|
term.findPrevious(actionElements.findPrevious.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
optionElements.cursorBlink.addEventListener('change', function () {
|
optionElements.cursorBlink.addEventListener('change', function () {
|
||||||
term.setOption('cursorBlink', optionElements.cursorBlink.checked);
|
term.setOption('cursorBlink', optionElements.cursorBlink.checked);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user