mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 02:51:57 +00:00
Optimize tab switching: saving only happens if state is 'DIRTY'
This commit is contained in:
parent
ddc4430bde
commit
685b9755b9
@ -3,7 +3,7 @@
|
||||
class="btn btn-secondary"
|
||||
[class.active]="filename === file"
|
||||
[class.disabled]="filename === file"
|
||||
(click)="sendCodeContents(); selectCode(file); requestCode()"
|
||||
(click)="tabSwitchButtonHandler(file)"
|
||||
[disabled]="filename === file">
|
||||
{{file}}
|
||||
</button>
|
||||
|
@ -76,6 +76,14 @@ export class WebideComponent implements OnInit {
|
||||
this.updateFileData(data);
|
||||
}
|
||||
|
||||
tabSwitchButtonHandler(file) {
|
||||
if (this.saveButtonState === 'DIRTY') {
|
||||
this.sendCodeContents();
|
||||
}
|
||||
this.selectCode(file);
|
||||
this.requestCode();
|
||||
}
|
||||
|
||||
setButtonStateSaved() {
|
||||
this.saveButtonState = 'SAVED';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user