Skip to content

Commit

Permalink
fix(xod-client): open console log with scrolled to the bottom content
Browse files Browse the repository at this point in the history
  • Loading branch information
brusherru committed Oct 23, 2018
1 parent 54ac82d commit ed69338
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/xod-client/src/debugger/containers/Log.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,27 @@ class Log extends React.PureComponent {
this.logEnd = null;

this.onFollowLog = this.onFollowLog.bind(this);
this.scrollToBottom = this.scrollToBottom.bind(this);
}

componentDidMount() {
// Postpone scrolling to the next tick
// so content could be rendered and then
// it will scroll to the right position
setTimeout(() => {
this.scrollToBottom('instant');
}, 0);
}

onFollowLog() {
this.scrollToBottom('smooth');
this.props.stopSkippingNewLogLines();
}

scrollToBottom(behavior) {
if (this.logEnd) {
this.logEnd.scrollIntoView({ behavior: 'smooth' });
this.logEnd.scrollIntoView({ behavior });
}

this.props.stopSkippingNewLogLines();
}

render() {
Expand Down

0 comments on commit ed69338

Please sign in to comment.