|
|
|
@ -105,7 +105,7 @@ export class CodeComponent implements OnInit {
|
|
|
|
|
this.loader.create({message: 'Loading code...'}).then(loader => {
|
|
|
|
|
loader.present().then(() => {
|
|
|
|
|
this.getInitObservable().subscribe(() => {
|
|
|
|
|
this.editorOptions.language = this.dbRecord.language;
|
|
|
|
|
this.editorOptions.language = this.dbRecord.Language;
|
|
|
|
|
this.editorOptions.readOnly = this.readonly;
|
|
|
|
|
this.onSelectChange(false);
|
|
|
|
|
loader.dismiss();
|
|
|
|
@ -136,7 +136,7 @@ export class CodeComponent implements OnInit {
|
|
|
|
|
this.api.get(`/code/${this.hostRecord.PageId}/${this.hostRecord.UUID}/get/${this.hostRecord.Value.Value}`).subscribe(res => {
|
|
|
|
|
this.dbRecord = res.data;
|
|
|
|
|
this.editorValue = this.dbRecord.code;
|
|
|
|
|
this.editorOptions.language = this.dbRecord.language;
|
|
|
|
|
this.editorOptions.language = this.dbRecord.Language;
|
|
|
|
|
this.pendingSetup = false;
|
|
|
|
|
sub.next(true);
|
|
|
|
|
sub.complete();
|
|
|
|
@ -154,11 +154,11 @@ export class CodeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.dbRecord.code = this.editorValue;
|
|
|
|
|
this.dbRecord.language = this.editorOptions.language;
|
|
|
|
|
this.dbRecord.Language = this.editorOptions.language;
|
|
|
|
|
this.api.post(`/code/${this.hostRecord.PageId}/${this.hostRecord.UUID}/set/${this.hostRecord.Value.Value}`, this.dbRecord)
|
|
|
|
|
.subscribe(res => {
|
|
|
|
|
this.dbRecord = res.data;
|
|
|
|
|
this.editorOptions.language = this.dbRecord.language;
|
|
|
|
|
this.editorOptions.language = this.dbRecord.Language;
|
|
|
|
|
this.editorValue = this.dbRecord.code;
|
|
|
|
|
this.dirty = false;
|
|
|
|
|
});
|
|
|
|
@ -200,7 +200,7 @@ export class CodeComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
onSelectChange(updateDbRecord = true) {
|
|
|
|
|
if ( updateDbRecord ) {
|
|
|
|
|
this.dbRecord.language = this.editorOptions.language;
|
|
|
|
|
this.dbRecord.Language = this.editorOptions.language;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.editorOptions = {...this.editorOptions};
|
|
|
|
|