mirror of
https://github.com/tsl0922/ttyd.git
synced 2025-12-24 04:34:19 +01:00
expose term instance to window for programatic use cases (#131)
* expose term to window for programatic use cases * add a brief introduction about the exposed window.term variable
This commit is contained in:
committed by
Shuanglei Tao
parent
1f6a6c7b78
commit
a428a7a430
@@ -118,6 +118,7 @@ Then open <http://localhost:8080> with a browser, you will get a bash shell with
|
||||
- If you want to login with your system accounts on the web browser, run `ttyd login`.
|
||||
- You can even run a none shell command like vim, try: `ttyd vim`, the web browser will show you a vim editor.
|
||||
- Sharing single process with multiple clients: `ttyd tmux new -A -s ttyd vim`, run `tmux new -A -s ttyd` to connect to the tmux session from terminal.
|
||||
- You can access underlying XTerm instance by calling `window.term` in browser, which allows you to interact with the term such as getting a snapshot of terminal content by `term.selectAll(); var terminalContent = term.getSelection().trim();`.
|
||||
|
||||
## Browser Support
|
||||
|
||||
|
||||
@@ -247,7 +247,9 @@ var openWs = function() {
|
||||
term.destroy();
|
||||
}
|
||||
|
||||
term = new Terminal({
|
||||
// expose term handle for some programatic cases
|
||||
// which need to get the content of the terminal
|
||||
term = window.term = new Terminal({
|
||||
fontSize: 13,
|
||||
fontFamily: '"Menlo for Powerline", Menlo, Consolas, "Liberation Mono", Courier, monospace',
|
||||
theme: {
|
||||
|
||||
2
src/index.html
vendored
2
src/index.html
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user