Moved some 'editors.component' items to the service

This commit is contained in:
2025-06-14 13:32:07 -05:00
parent c6b2632487
commit 7f55d68372
2 changed files with 40 additions and 23 deletions

View File

@@ -1,7 +1,10 @@
import { Injectable } from '@angular/core';
import { ComponentRef, Injectable } from '@angular/core';
import { BehaviorSubject, ReplaySubject, Observable } from 'rxjs';
import { NewtonEditorComponent } from "../../../editor/newton-editor/newton-editor.component";
import { ServiceMessage } from '../../types/service-message.type';
import { EditorSettings } from "../../configs/editor.config";
@@ -18,8 +21,27 @@ export class EditorsService {
private moveSessionLeftSubject: ReplaySubject<any> = new ReplaySubject<any>(1);
private moveSessionRightSubject: ReplaySubject<any> = new ReplaySubject<any>(1);
editors: Map<string, ComponentRef<NewtonEditorComponent>>;
editorSettings: typeof EditorSettings;
constructor() {}
constructor() {
this.editorSettings = EditorSettings;
this.editors = new Map<string, ComponentRef<NewtonEditorComponent>>();
}
getEditorsAsArray(): ComponentRef<NewtonEditorComponent>[] {
return [...this.editors.values()];
}
get(uuid: string): NewtonEditorComponent {
return this.editors.get(uuid).instance;
}
set(uuid: string, component: ComponentRef<NewtonEditorComponent>) {
this.editors.set(uuid, component);
}
setData(data: ServiceMessage): void {