Dmytri Kleiner
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
0 deletions
-
package.json
-
src/client/wetty/term.ts
|
|
@ -120,6 +120,7 @@ |
|
|
|
"winston": "^3.3.3", |
|
|
|
"xterm": "^4.8.1", |
|
|
|
"xterm-addon-fit": "^0.4.0", |
|
|
|
"xterm-addon-web-links": "^0.4.0", |
|
|
|
"yargs": "^15.4.1" |
|
|
|
}, |
|
|
|
"devDependencies": { |
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
import type { Socket } from 'socket.io-client'; |
|
|
|
import _ from 'lodash'; |
|
|
|
import { WebLinksAddon } from 'xterm-addon-web-links'; |
|
|
|
import { FitAddon } from 'xterm-addon-fit'; |
|
|
|
import { Terminal } from 'xterm'; |
|
|
|
|
|
|
@ -10,6 +11,8 @@ import { terminal as termElement } from '../shared/elements.js'; |
|
|
|
export function terminal(socket: typeof Socket): Term | undefined { |
|
|
|
const term = new Terminal() as Term; |
|
|
|
if (_.isNull(termElement)) return; |
|
|
|
const webLinksAddon = new WebLinksAddon(); |
|
|
|
term.loadAddon(webLinksAddon); |
|
|
|
const fitAddon = new FitAddon(); |
|
|
|
term.loadAddon(fitAddon); |
|
|
|
term.open(termElement); |
|
|
|