/** * @module component */ import type { IViewBased, IViewComponent } from 'jodit/types'; import { Component } from './component'; export abstract class ViewComponent extends Component implements IViewComponent { /** * Parent View element */ jodit!: T; /** * Shortcut for `this.jodit` */ get j(): T { return this.jodit; } get defaultTimeout(): number { return this.j.defaultTimeout; } i18n(text: string, ...params: Array): string { return this.j.i18n(text, ...params); } /** * Attach component to View */ setParentView(jodit: T): this { this.jodit = jodit; jodit.components.add(this); return this; } constructor(jodit: T) { super(); this.setParentView(jodit); } /** @override */ override destruct(): any { this.j.components.delete(this); return super.destruct(); } }