MCPcopy Index your code
hub / github.com/angular/angular / EmbeddedEditor

Class EmbeddedEditor

adev/src/app/editor/embedded-editor.component.ts:52–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 providers: [EditorUiState],
51})
52export class EmbeddedEditor {
53 // Prevents from adding, removing or renaming files
54 readonly restrictedMode = input<boolean>(false);
55
56 readonly editorContainer = viewChild<ElementRef<HTMLDivElement>>('editorContainer');
57 readonly matTabGroup = viewChild(MatTabGroup);
58
59 private readonly platformId = inject(PLATFORM_ID);
60 private readonly destroyRef = inject(DestroyRef);
61
62 private readonly diagnosticsState = inject(DiagnosticsState);
63 readonly editorUiState = inject(EditorUiState);
64 private readonly nodeRuntimeState = inject(NodeRuntimeState);
65 private readonly nodeRuntimeSandbox = inject(NodeRuntimeSandbox);
66
67 protected readonly splitDirection = signal<'horizontal' | 'vertical'>('vertical');
68
69 readonly MAX_RECOMMENDED_WEBCONTAINERS_INSTANCES = MAX_RECOMMENDED_WEBCONTAINERS_INSTANCES;
70
71 protected readonly TerminalType = TerminalType;
72 protected readonly displayOnlyTerminal = computed(
73 () => this.editorUiState.tutorialType() === TutorialType.CLI,
74 );
75 protected readonly displayPreviewInMatTabGroup = signal<boolean>(true);
76 protected readonly selectedTabIndex = linkedSignal({
77 source: () => this.displayPreviewInMatTabGroup(),
78 computation: () => 0,
79 });
80
81 protected readonly shouldEnableReset = computed(
82 () =>
83 this.nodeRuntimeState.loadingStep() > LoadingStep.BOOT &&
84 !this.nodeRuntimeState.isResetting(),
85 );
86
87 private readonly errorsCount$ = this.diagnosticsState.diagnostics$.pipe(
88 map((diagnosticsItem) => diagnosticsItem.filter((item) => item.severity === 'error').length),
89 );
90 protected readonly errorsCount = toSignal(this.errorsCount$, {initialValue: 0});
91
92 constructor() {
93 if (!isPlatformBrowser(this.platformId)) {
94 return;
95 }
96
97 const ref = afterRenderEffect({
98 read: () => {
99 const container = this.editorContainer()?.nativeElement;
100 if (!container) {
101 return;
102 }
103 this.setResizeObserver(container);
104 ref.destroy();
105 },
106 });
107 }
108
109 protected async reset(): Promise<void> {

Callers

nothing calls this directly

Calls 7

injectFunction · 0.90
signalFunction · 0.90
computedFunction · 0.90
linkedSignalFunction · 0.90
toSignalFunction · 0.90
inputFunction · 0.85
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…