diff --git a/src/player.jsx b/src/player.jsx index b8a77f8..53c75c3 100644 --- a/src/player.jsx +++ b/src/player.jsx @@ -44,6 +44,13 @@ return value; } + let scrollToBottom = function(id) { + const el = document.getElementById(id); + if (el) { + el.scrollTop = el.scrollHeight; + } + } + /* * An auto-loading buffer of recording's packets. */ @@ -488,7 +495,14 @@ render() { return( - +
+
+ Input +
+
+ +
+
); } @@ -520,6 +534,7 @@ this.zoom = this.zoom.bind(this); this.fastForwardToTS = this.fastForwardToTS.bind(this); this.sendInput = this.sendInput.bind(this); + this.clearInputPlayer = this.clearInputPlayer.bind(this); this.state = { cols: 80, @@ -807,7 +822,12 @@ this.setState({speedExp: 0}); } + clearInputPlayer() { + this.setState({input: null}); + } + rewindToStart() { + this.clearInputPlayer(); this.reset(); this.sync(); } @@ -955,6 +975,9 @@ this.speed = Math.pow(2, this.state.speedExp); this.sync(); } + if (this.state.input != prevState.input) { + scrollToBottom("input-textarea"); + } } render() { @@ -1017,75 +1040,79 @@ // ensure react never reuses this div by keying it with the terminal widget return ( -
-
-
- {this.state.title} -
-
-
-
-
-
-
-