From 12dd5c7d8278e5cd331d4b018941e901cec9b1a1 Mon Sep 17 00:00:00 2001 From: Shohei Kameda Date: Thu, 25 Jul 2019 23:06:03 +0900 Subject: [PATCH] html: added window.term.fit --- html/src/components/terminal/index.tsx | 7 ++++++- src/index.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/html/src/components/terminal/index.tsx b/html/src/components/terminal/index.tsx index 42660ec..f8f4a99 100644 --- a/html/src/components/terminal/index.tsx +++ b/html/src/components/terminal/index.tsx @@ -10,8 +10,10 @@ import { ZmodemAddon } from '../zmodem'; import 'xterm/dist/xterm.css'; +type TerminalExtended = Terminal & FitAddon; + export interface WindowExtended extends Window { - term: Terminal; + term: TerminalExtended; tty_auth_token?: string; } declare let window: WindowExtended; @@ -120,6 +122,9 @@ export class Xterm extends Component { this.terminal = new Terminal(this.props.options); const { socket, terminal, container, fitAddon, overlayAddon } = this; window.term = terminal; + window.term.fit = () => { + this.fitAddon.fit(); + }; socket.binaryType = 'arraybuffer'; socket.onopen = this.onSocketOpen; diff --git a/src/index.html b/src/index.html index 4490ade..9aa8fb1 100644 --- a/src/index.html +++ b/src/index.html @@ -1 +1 @@ -ttyd - Terminal \ No newline at end of file +ttyd - Terminal \ No newline at end of file -- 2.43.4