Merge pull request #3 from avatao-content/webide_rework

Webide rework
This commit is contained in:
Bokros Bálint 2018-02-08 17:40:12 +01:00 committed by GitHub
commit a6ee39156b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,6 @@
<app-header></app-header>
<div class="container-fluid">
<div class="row tfw-first-row">
<div class="row">
<div class="col-sm"><app-login></app-login></div>
<div class="col-sm-6"><app-webide></app-webide></div>
<div class="col-sm"><app-messages></app-messages></div>

View File

@ -2,4 +2,5 @@ export class SourceCode {
filename: string;
content: string;
language: string;
files: string[];
}

View File

@ -1,3 +1,12 @@
<div class="btn-group btn-group-sm flex-wrap">
<button *ngFor="let file of files"
class="btn btn-secondary"
[class.active]="filename === file"
(click)="selectCode(file); requestCode();">
{{file}}
</button>
</div>
<div
ace-editor
[(text)]="code"

View File

@ -3,3 +3,15 @@
width:100%;
overflow: auto;
}
.editor-tabs {
list-style: none;
}
.editor-li {
float: left;
}
.btn-secondary {
border-radius: 0;
}

View File

@ -19,6 +19,7 @@ export class WebideComponent implements OnInit {
code: string = defaultSourceCode;
language = 'javascript';
theme = 'monokai';
files: string[];
constructor(private webSocketService: WebSocketService) { }
@ -27,6 +28,7 @@ export class WebideComponent implements OnInit {
this.filename = event.data.filename;
this.code = event.data.content;
this.language = event.data.language;
this.files = event.data.files;
});
this.requestCode();
}
@ -44,4 +46,10 @@ export class WebideComponent implements OnInit {
});
}
selectCode(filename: string) {
this.webSocketService.send(this.anchor_id, {
'command': 'select',
'filename': filename
});
}
}