feat: scroll to the end of the firmware log when success of faild panel visible (#1018)
This commit is contained in:
committed by
László Monda
parent
c4269d4cf1
commit
79f467603a
@@ -13,10 +13,8 @@ export class XtermComponent implements OnChanges {
|
||||
@ViewChild('scrollMe', { static: false }) divElement: ElementRef;
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes.logs && this.divElement && this.divElement.nativeElement) {
|
||||
setTimeout(() => {
|
||||
this.divElement.nativeElement.scrollTop = this.divElement.nativeElement.scrollHeight;
|
||||
});
|
||||
if (changes.logs) {
|
||||
this.scrollToTheEnd();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +22,11 @@ export class XtermComponent implements OnChanges {
|
||||
return this.logs.reduce((value, line) => value + line.message + '\n', '');
|
||||
}
|
||||
|
||||
scrollToTheEnd(): void {
|
||||
setTimeout(() => {
|
||||
if (this.divElement && this.divElement.nativeElement) {
|
||||
this.divElement.nativeElement.scrollTop = this.divElement.nativeElement.scrollHeight;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user