mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 06:11:56 +00:00
Merge pull request #15 from avatao-content/webide-directories
Implement workdir changing support on frontend
This commit is contained in:
commit
ecec5e9bbe
@ -1,6 +1,7 @@
|
|||||||
export interface SourceCode {
|
export interface SourceCode {
|
||||||
filename?: string;
|
filename: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
files?: string[];
|
files: string[];
|
||||||
|
directory: string;
|
||||||
command: string;
|
command: string;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ export class WebideComponent implements OnInit {
|
|||||||
code: string = defaultSourceCode;
|
code: string = defaultSourceCode;
|
||||||
language = 'javascript';
|
language = 'javascript';
|
||||||
theme = 'monokai';
|
theme = 'monokai';
|
||||||
|
directory = '';
|
||||||
files: string[];
|
files: string[];
|
||||||
codeState = 'SAVED';
|
codeState = 'SAVED';
|
||||||
deployButtonState = 'DEPLOYED';
|
deployButtonState = 'DEPLOYED';
|
||||||
@ -39,7 +40,8 @@ export class WebideComponent implements OnInit {
|
|||||||
command_handlers = {'reload': this.reloadHandler.bind(this),
|
command_handlers = {'reload': this.reloadHandler.bind(this),
|
||||||
'read': this.readHandler.bind(this),
|
'read': this.readHandler.bind(this),
|
||||||
'select': this.selectHandler.bind(this),
|
'select': this.selectHandler.bind(this),
|
||||||
'write': this.writeHandler.bind(this)};
|
'write': this.writeHandler.bind(this),
|
||||||
|
'selectdir': this.selectdirHandler.bind(this)};
|
||||||
|
|
||||||
constructor(private webSocketService: WebSocketService,
|
constructor(private webSocketService: WebSocketService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
@ -64,6 +66,7 @@ export class WebideComponent implements OnInit {
|
|||||||
|
|
||||||
updateFileData(data: SourceCode) {
|
updateFileData(data: SourceCode) {
|
||||||
this.filename = data.filename;
|
this.filename = data.filename;
|
||||||
|
this.directory = data.directory;
|
||||||
this.code = data.content;
|
this.code = data.content;
|
||||||
this.language = modelist.getModeForPath(this.filename).name;
|
this.language = modelist.getModeForPath(this.filename).name;
|
||||||
this.files = data.files;
|
this.files = data.files;
|
||||||
@ -86,6 +89,10 @@ export class WebideComponent implements OnInit {
|
|||||||
this.setCodeState('SAVED');
|
this.setCodeState('SAVED');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectdirHandler(data: SourceCode) {
|
||||||
|
this.updateFileData(data);
|
||||||
|
}
|
||||||
|
|
||||||
resetAutoSaveCountdown() {
|
resetAutoSaveCountdown() {
|
||||||
if (this.autosave) {
|
if (this.autosave) {
|
||||||
clearInterval(this.autosave);
|
clearInterval(this.autosave);
|
||||||
|
Loading…
Reference in New Issue
Block a user