Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 81x 81x 81x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Component, Input, OnDestroy } from '@angular/core';
import { ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
import { autorun, IReactionDisposer } from 'mobx';
import { MonacoEditorModule } from 'ngx-monaco-editor';
import { ResizeHandleDirective } from '../../directive/resize-handle.directive';
import { ConfigService } from '../../service/config.service';
import { Store } from '../../store/store';
@Component({
selector: 'app-json',
templateUrl: './json.component.html',
styleUrls: ['./json.component.scss'],
host: { 'class': 'json-editor' },
imports: [ReactiveFormsModule, MonacoEditorModule, ResizeHandleDirective]
})
export class JsonComponent implements OnDestroy {
private disposers: IReactionDisposer[] = [];
@Input()
group!: UntypedFormGroup;
@Input()
fieldName = 'source';
options: any = {
language: 'json',
automaticLayout: true,
};
constructor(
public config: ConfigService,
private store: Store,
) {
this.disposers.push(autorun(() => {
this.options = {
...this.options,
theme: store.darkTheme ? 'vs-dark' : 'vs',
}
}));
}
ngOnDestroy() {
for (const dispose of this.disposers) dispose();
this.disposers.length = 0;
}
}
|