mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 05:32:55 +00:00 
			
		
		
		
	Implement workdir change support in webide
This commit is contained in:
		@@ -32,6 +32,7 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
  code: string = defaultSourceCode;
 | 
			
		||||
  language = 'javascript';
 | 
			
		||||
  theme = 'monokai';
 | 
			
		||||
  directory = '';
 | 
			
		||||
  files: string[];
 | 
			
		||||
  codeState = 'SAVED';
 | 
			
		||||
  deployButtonState = 'DEPLOYED';
 | 
			
		||||
@@ -39,7 +40,8 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
  command_handlers = {'reload':    this.reloadHandler.bind(this),
 | 
			
		||||
                      'read':      this.readHandler.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,
 | 
			
		||||
              private changeDetectorRef: ChangeDetectorRef,
 | 
			
		||||
@@ -64,6 +66,7 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
  updateFileData(data: SourceCode) {
 | 
			
		||||
    this.filename = data.filename;
 | 
			
		||||
    this.directory = data.directory;
 | 
			
		||||
    this.code = data.content;
 | 
			
		||||
    this.language = modelist.getModeForPath(this.filename).name;
 | 
			
		||||
    this.files = data.files;
 | 
			
		||||
@@ -86,6 +89,10 @@ export class WebideComponent implements OnInit {
 | 
			
		||||
    this.setCodeState('SAVED');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  selectdirHandler(data: SourceCode) {
 | 
			
		||||
    this.updateFileData(data);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  resetAutoSaveCountdown() {
 | 
			
		||||
    if (this.autosave) {
 | 
			
		||||
      clearInterval(this.autosave);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user