mirror of
https://github.com/tsl0922/ttyd.git
synced 2025-12-22 20:04:19 +01:00
html: webgl renderer support
This commit is contained in:
@@ -62,9 +62,10 @@
|
||||
"decko": "^1.2.0",
|
||||
"file-saver": "^2.0.2",
|
||||
"preact": "^10.0.5",
|
||||
"xterm": "^4.2.0",
|
||||
"xterm": "^4.3.0",
|
||||
"xterm-addon-fit": "^0.3.0",
|
||||
"xterm-addon-web-links": "^0.2.1",
|
||||
"xterm-addon-webgl": "^0.4.0",
|
||||
"zmodem.js": "^0.1.9"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as backoff from 'backoff';
|
||||
import { Component, h } from 'preact';
|
||||
import { ITerminalOptions, Terminal } from 'xterm';
|
||||
import { FitAddon } from 'xterm-addon-fit';
|
||||
import { WebglAddon } from 'xterm-addon-webgl';
|
||||
import { WebLinksAddon } from 'xterm-addon-web-links';
|
||||
|
||||
import { OverlayAddon } from './overlay';
|
||||
@@ -221,8 +222,13 @@ export class Xterm extends Component<Props> {
|
||||
case Command.SET_PREFERENCES:
|
||||
const preferences = JSON.parse(textDecoder.decode(data));
|
||||
Object.keys(preferences).forEach(key => {
|
||||
console.log(`[ttyd] setting ${key}: ${preferences[key]}`);
|
||||
terminal.setOption(key, preferences[key]);
|
||||
if (key === 'rendererType' && preferences[key] === 'webgl') {
|
||||
terminal.loadAddon(new WebglAddon());
|
||||
console.log(`[ttyd] WebGL renderer enabled`);
|
||||
} else {
|
||||
console.log(`[ttyd] option: ${key}=${preferences[key]}`);
|
||||
terminal.setOption(key, preferences[key]);
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -8623,7 +8623,12 @@ xterm-addon-web-links@^0.2.1:
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.1.tgz#6d1f2ce613e09870badf17615e7a1170a31542b2"
|
||||
integrity sha512-2KnHtiq0IG7hfwv3jw2/jQeH1RBk2d5CH4zvgwQe00rLofSJqSfgnJ7gwowxxpGHrpbPr6Lv4AmH/joaNw2+HQ==
|
||||
|
||||
xterm@^4.2.0:
|
||||
xterm-addon-webgl@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0.tgz#7b7cdbdbf9b0d06189af20d468d8ea2798382e0f"
|
||||
integrity sha512-2ExOKJQcyv4hUo/d41uMDe7fNZCi42kPtbvG/v+dVj1NwqGD7g1bhuoH2j1iA1vTP5O1fClc6pU9nLBpbwrdZQ==
|
||||
|
||||
xterm@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0.tgz#9a302efefe75172d4f7ea3afc20f9bd983f05027"
|
||||
integrity sha512-6dnrC4nxgnRKQzIWwC5HA0mnT9/rpDPZflUIr24gdcdSMTKM1QQcor4qQ/xz4Zerz6AIL/CuuBPypFfzsB63dQ==
|
||||
|
||||
Reference in New Issue
Block a user