mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:41:32 +00:00
Create initial version of TerminalComponent
This commit is contained in:
parent
4607219ed6
commit
5846defd2c
1
src/app/terminal/terminal.component.html
Normal file
1
src/app/terminal/terminal.component.html
Normal file
@ -0,0 +1 @@
|
||||
<div #xterm class="tfw-xterm mt-3 mb-3" (window:resize)="fit()"></div>
|
0
src/app/terminal/terminal.component.scss
Normal file
0
src/app/terminal/terminal.component.scss
Normal file
29
src/app/terminal/terminal.component.ts
Normal file
29
src/app/terminal/terminal.component.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
|
||||
import { TerminadoService } from '../terminado.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-terminal',
|
||||
templateUrl: './terminal.component.html',
|
||||
styleUrls: ['./terminal.component.scss']
|
||||
})
|
||||
export class TerminalComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('xterm') target: ElementRef;
|
||||
|
||||
constructor(private terminadoService: TerminadoService) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.terminadoService.attach(this.target.nativeElement as HTMLElement);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.terminadoService.detach();
|
||||
}
|
||||
|
||||
fit() {
|
||||
this.terminadoService.fit();
|
||||
}
|
||||
}
|
@ -1,2 +1,3 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
@import '../node_modules/bootstrap/scss/bootstrap';
|
||||
@import '../node_modules/xterm/dist/xterm.css';
|
||||
|
Loading…
Reference in New Issue
Block a user