Commit e6e6d487 authored by Ayush's avatar Ayush

Minor update

parent 3b822e68
......@@ -31,7 +31,8 @@ export class IdeComponent implements OnInit {
@ViewChild(IdeCompileComponent) runField;
@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 {
const editorArea = document.getElementById('editor');
......@@ -76,8 +77,10 @@ int main() {
};
editor.on('update', () => {
this.isUpToDate = false;
document.getElementById('saveBtn').innerHTML = 'Save File';
if (!this.isUploading) {
this.isUpToDate = false;
document.getElementById('saveBtn').innerHTML = 'Save File';
}
code[activeLang] = editor.getValue();
this.file.text = editor.getValue();
});
......@@ -90,7 +93,9 @@ int main() {
updateFile(): void {
const btn = document.getElementById('saveBtn') as HTMLButtonElement;
if (btn.classList.contains('disabled')) {return; }
if (btn.classList.contains('disabled')) {
return;
}
this.isUploading = true;
btn.innerHTML = 'Saving...';
this.fileService.upload(this.file)
......@@ -100,6 +105,8 @@ int main() {
this.isUpToDate = true;
}, 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