Commit e6e6d487 authored by Ayush's avatar Ayush

Minor update

parent 3b822e68
...@@ -31,7 +31,8 @@ export class IdeComponent implements OnInit { ...@@ -31,7 +31,8 @@ export class IdeComponent implements OnInit {
@ViewChild(IdeCompileComponent) runField; @ViewChild(IdeCompileComponent) runField;
@ViewChild(SaveFileComponent) saveField; @ViewChild(SaveFileComponent) saveField;
constructor(public router: Router, public runCodeService: RunCodeService, private fileService: FileService) {} constructor(public router: Router, public runCodeService: RunCodeService, private fileService: FileService) {
}
ngOnInit(): void { ngOnInit(): void {
const editorArea = document.getElementById('editor'); const editorArea = document.getElementById('editor');
...@@ -76,8 +77,10 @@ int main() { ...@@ -76,8 +77,10 @@ int main() {
}; };
editor.on('update', () => { editor.on('update', () => {
if (!this.isUploading) {
this.isUpToDate = false; this.isUpToDate = false;
document.getElementById('saveBtn').innerHTML = 'Save File'; document.getElementById('saveBtn').innerHTML = 'Save File';
}
code[activeLang] = editor.getValue(); code[activeLang] = editor.getValue();
this.file.text = editor.getValue(); this.file.text = editor.getValue();
}); });
...@@ -90,7 +93,9 @@ int main() { ...@@ -90,7 +93,9 @@ int main() {
updateFile(): void { updateFile(): void {
const btn = document.getElementById('saveBtn') as HTMLButtonElement; const btn = document.getElementById('saveBtn') as HTMLButtonElement;
if (btn.classList.contains('disabled')) {return; } if (btn.classList.contains('disabled')) {
return;
}
this.isUploading = true; this.isUploading = true;
btn.innerHTML = 'Saving...'; btn.innerHTML = 'Saving...';
this.fileService.upload(this.file) this.fileService.upload(this.file)
...@@ -100,6 +105,8 @@ int main() { ...@@ -100,6 +105,8 @@ int main() {
this.isUpToDate = true; this.isUpToDate = true;
}, error => { }, error => {
console.log(error); console.log(error);
this.isUploading = false;
btn.innerHTML = 'Save File';
}); });
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment