import { Inject } from "@web-atoms/core/dist/di/Inject";
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
import IFileModel from "../model/FileModel";
import FileService from "../services/FileService";
import CodeEditorStyle from "./CodeEditorStyle";
import CodeEditorViewModel from "./CodeEditorViewModel";

export default class CodeEditor extends AtomControl {

    public file: IFileModel;

    constructor(app: any, e?: any) {
        super(app, e || document.createElement("iframe"));
    }

    protected preCreate() {
        this.file = null;
        this.localViewModel = this.resolve(CodeEditorViewModel, "owner");
        this.defaultControlStyle = CodeEditorStyle;
        super.preCreate();
        this.runAfterInit(() => {
            this.element.className = this.controlStyle.name;
        });
    }

}
