@@ -31,7 +31,14 @@ export class EditorComponent implements OnInit,AfterViewInit {
3131 constructor ( public service : DataService , private route : ActivatedRoute ) { }
3232
3333 ngOnInit ( ) {
34+ console . log ( "editor: ngOnInit " + this . codeEditorElmRef ) ;
3435 this . getTabbedSessions ( ) ;
36+
37+ this . service . viewTextRequests . subscribe ( a => {
38+ this . getTabbedSessions ( ) ;
39+ this . loadSession ( this . service . selectedEditorTab ) ;
40+ } ) ;
41+
3542 // console.log("selected tab: " + this.service.selectedEditorTab+" tabkexs: "+this.tabKeys);
3643 if ( this . tabKeys . length < 1 ) {
3744 return ;
@@ -62,9 +69,16 @@ export class EditorComponent implements OnInit,AfterViewInit {
6269
6370 }
6471
72+ shouldShowTab ( ) {
73+ console . log ( "Tab count: " + this . tabKeys . length ) ;
74+ return this . tabKeys . length > 0 ;
75+ }
76+
6577 ngAfterViewInit ( ) {
78+ console . log ( "editor: ngAfterViewInit " + this . codeEditorElmRef ) ;
6679 ace . require ( 'ace/ext/language_tools' ) ;
6780 if ( ! this . codeEditorElmRef ) {
81+ console . log ( "Code editor reference not found" ) ;
6882 return ;
6983 }
7084 const element = this . codeEditorElmRef . nativeElement ;
@@ -96,6 +110,7 @@ export class EditorComponent implements OnInit,AfterViewInit {
96110
97111 getTabbedSessions ( ) : void {
98112 this . tabKeys = Object . keys ( this . service . editorContexts ) ;
113+ console . log ( "tab keys: " + JSON . stringify ( this . tabKeys ) )
99114 // this.service.editorContexts.forEach((value: EditorContext, key: string) => {
100115 // this.tabKeys.push(key);
101116 // console.log("tabbed key: " + key);
@@ -123,6 +138,9 @@ export class EditorComponent implements OnInit,AfterViewInit {
123138 }
124139
125140 onResize ( event : any ) {
141+ if ( ! this . codeEditorElmRef ) {
142+ return ;
143+ }
126144 //console.log("window resized");
127145 let doc : any = this . codeEditor . getSession ( ) . getDocument ( ) ;
128146 let r : any = this . codeEditor . renderer ;
0 commit comments