import {Component, Input, OnInit} from '@angular/core';
import {EditorService} from '../../../service/editor.service';

@Component({
    selector: 'noded-file-box-page',
    template: `
        <div class="container" *ngIf="ready">
            <editor-file-box [nodeId]="nodeId" [editorUUID]="this.editorService.instanceUUID" [fullPage]="true"></editor-file-box>
        </div>
    `,
    styles: [
        `
            .container {
                height: 100%;
            }

            editor-database {
                height: 100%;
                display: flex;
            }
        `,
    ],
})
export class FileBoxPageComponent implements OnInit {
    @Input() nodeId: string;
    @Input() pageId: string;

    public ready = false;

    constructor(
        public editorService: EditorService,
    ) {
        this.editorService = editorService.getEditor();
    }

    ngOnInit() {
        this.editorService.startEditing(this.pageId).then(() => {
            this.ready = true;
        });
    }
}
