Skip to content

Commit 4b07803

Browse files
author
subhra74
committed
fixed editor issue
1 parent 50d2a95 commit 4b07803

File tree

11 files changed

+404
-365
lines changed

11 files changed

+404
-365
lines changed

ui/src/app/data.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export class DataService {
7878

7979
currentViewChanger = new Subject<string>();
8080

81+
viewTextRequests=new Subject<string>();
82+
8183
terminalSession: TerminalSession;
8284

8385
constructor(private http: HttpClient) {

ui/src/app/home/editor/editor.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<div style="height: calc(100vh - 55px); width: 100vw; display: flex; flex-direction: column; position: fixed; top: 55px; left: 0px; z-index: 100; background: white;"
2-
*ngIf="tabKeys.length>0">
1+
<div style="height: calc(100vh - 55px); width: 100vw; display: flex; flex-direction: column; position: fixed; top: 55px; left: 0px; background: white; z-index: 10;">
32
<div class="desktop-tabs" *ngIf="service.selectedEditorTab">
43
<div *ngFor="let tab of tabKeys"
54
style="padding: 10px; padding-left: 5px; padding-right: 5px; display: flex; justify-content: space-between;"
@@ -32,6 +31,6 @@
3231
</div>
3332

3433
<div *ngIf="tabKeys.length<1"
35-
style="height: calc(100vh - 55px); width: 100vw; position: fixed; top: 55px; left: 0px; z-index: 100; background: white; text-align: center; padding-top: 30px;">
34+
style="height: calc(100vh - 55px); width: 100vw; position: fixed; top: 55px; left: 0px; background: white; text-align: center; padding-top: 30px;">
3635
<span>No file is opened, please goto files and select some.</span>
3736
</div>

ui/src/app/home/editor/editor.component.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)