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 49 50 51 52 53 54 55 | 69x 69x 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-code',
templateUrl: './code.component.html',
styleUrls: ['./code.component.scss'],
imports: [ReactiveFormsModule, MonacoEditorModule, ResizeHandleDirective]
})
export class CodeComponent implements OnDestroy {
private disposers: IReactionDisposer[] = [];
@Input()
group!: UntypedFormGroup;
@Input()
fieldName = 'source';
options: any = {
language: 'css',
automaticLayout: true,
};
constructor(
public config: ConfigService,
private store: Store,
) {
this.disposers.push(autorun(() => {
this.options = {
...this.options,
theme: store.darkTheme ? 'vs-dark' : 'vs',
}
}));
}
@Input()
set language(value: string) {
this.options = {
...this.options,
language: value,
}
}
ngOnDestroy() {
for (const dispose of this.disposers) dispose();
this.disposers.length = 0;
}
}
|