From: Shohei Kameda Date: Thu, 25 Jul 2019 14:06:03 +0000 (+0900) Subject: html: added window.term.fit X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=12dd5c7d8278e5cd331d4b018941e901cec9b1a1;p=ttyd.git html: added window.term.fit --- 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