Fix 2FA sizing issue, add support for copying text from xterm.js (#1825)

closes #1812, closes #1813
This commit is contained in:
Matthew Penner 2020-02-11 10:37:12 -07:00 committed by GitHub
parent 1b1c95d8ce
commit b05048871c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 35 deletions

View file

@ -81,6 +81,17 @@ export default () => {
// @see https://github.com/xtermjs/xterm.js/issues/2265
// @see https://github.com/xtermjs/xterm.js/issues/2230
TerminalFit.fit(terminal);
// Add support for copying terminal text.
terminal.attachCustomKeyEventHandler((e: KeyboardEvent) => {
// Ctrl + C
if (e.ctrlKey && (e.key === 'c')) {
document.execCommand('copy');
return false;
}
return true;
});
}
}, [ terminal, connected, terminalElement ]);