Skip to content

Commit

Permalink
fixed editor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
subhra74 committed Jul 12, 2019
1 parent 50d2a95 commit 4b07803
Show file tree
Hide file tree
Showing 11 changed files with 404 additions and 365 deletions.
2 changes: 2 additions & 0 deletions ui/src/app/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export class DataService {

currentViewChanger = new Subject<string>();

viewTextRequests=new Subject<string>();

terminalSession: TerminalSession;

constructor(private http: HttpClient) {
Expand Down
5 changes: 2 additions & 3 deletions ui/src/app/home/editor/editor.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div style="height: calc(100vh - 55px); width: 100vw; display: flex; flex-direction: column; position: fixed; top: 55px; left: 0px; z-index: 100; background: white;"
*ngIf="tabKeys.length>0">
<div style="height: calc(100vh - 55px); width: 100vw; display: flex; flex-direction: column; position: fixed; top: 55px; left: 0px; background: white; z-index: 10;">
<div class="desktop-tabs" *ngIf="service.selectedEditorTab">
<div *ngFor="let tab of tabKeys"
style="padding: 10px; padding-left: 5px; padding-right: 5px; display: flex; justify-content: space-between;"
Expand Down Expand Up @@ -32,6 +31,6 @@
</div>

<div *ngIf="tabKeys.length<1"
style="height: calc(100vh - 55px); width: 100vw; position: fixed; top: 55px; left: 0px; z-index: 100; background: white; text-align: center; padding-top: 30px;">
style="height: calc(100vh - 55px); width: 100vw; position: fixed; top: 55px; left: 0px; background: white; text-align: center; padding-top: 30px;">
<span>No file is opened, please goto files and select some.</span>
</div>
18 changes: 18 additions & 0 deletions ui/src/app/home/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ export class EditorComponent implements OnInit,AfterViewInit {
constructor(public service: DataService, private route: ActivatedRoute) { }

ngOnInit() {
console.log("editor: ngOnInit "+this.codeEditorElmRef);
this.getTabbedSessions();

this.service.viewTextRequests.subscribe(a=>{
this.getTabbedSessions();
this.loadSession(this.service.selectedEditorTab);
});

// console.log("selected tab: " + this.service.selectedEditorTab+" tabkexs: "+this.tabKeys);
if(this.tabKeys.length<1){
return;
Expand Down Expand Up @@ -62,9 +69,16 @@ export class EditorComponent implements OnInit,AfterViewInit {

}

shouldShowTab(){
console.log("Tab count: "+this.tabKeys.length);
return this.tabKeys.length>0;
}

ngAfterViewInit(){
console.log("editor: ngAfterViewInit "+this.codeEditorElmRef);
ace.require('ace/ext/language_tools');
if(!this.codeEditorElmRef){
console.log("Code editor reference not found");
return;
}
const element = this.codeEditorElmRef.nativeElement;
Expand Down Expand Up @@ -96,6 +110,7 @@ export class EditorComponent implements OnInit,AfterViewInit {

getTabbedSessions(): void {
this.tabKeys = Object.keys(this.service.editorContexts);
console.log("tab keys: "+JSON.stringify(this.tabKeys))
// this.service.editorContexts.forEach((value: EditorContext, key: string) => {
// this.tabKeys.push(key);
// console.log("tabbed key: " + key);
Expand Down Expand Up @@ -123,6 +138,9 @@ export class EditorComponent implements OnInit,AfterViewInit {
}

onResize(event: any) {
if(!this.codeEditorElmRef){
return;
}
//console.log("window resized");
let doc: any = this.codeEditor.getSession().getDocument();
let r: any = this.codeEditor.renderer;
Expand Down
Loading

0 comments on commit 4b07803

Please sign in to comment.