import { FocusMonitor } from '@angular/cdk/a11y'; import { AfterContentInit, ChangeDetectorRef, EventEmitter, OnDestroy, Provider } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { OutputData, SanitizerConfig } from '@editorjs/editorjs'; import { Observable, Subject, Subscription } from 'rxjs'; import { NgxEditorJSDirective } from '../../directives/ngx-editorjs.directive'; import { NgxEditorJSService } from '../../services/editorjs.service'; import { Block } from '../../types/blocks'; /** * The `NgxEditorJSBaseComponent` Provider for `NG_VALUE_ACCESSOR` */ export declare const EDITORJS_FORM_VALUE_ACCESSOR: Provider; /** * The `NgxEditorJSBaseComponent` is a fully implemented Angular component for creating EditorJS instances * within an Angular application or Angular Reactive Form. * The component provides `@Input` properties for all the configuration options of * a EditorJS instance and `@Output` Event Emitters to listen to changes * The instance also provides an Autosave feature by providing an autosave time in `ms` or `0` to disable. * @example * */ export declare class NgxEditorJSComponent implements OnDestroy, AfterContentInit, ControlValueAccessor { protected readonly editorService: NgxEditorJSService; protected readonly focusMonitor: FocusMonitor; protected readonly changeDetection: ChangeDetectorRef; /** * The directive used in this component */ readonly editorInstance: NgxEditorJSDirective; /** * Component Destroy subject, in your component `ngOnDestroy` method call `.next(true)` * and then `.complete()` on the `this.onDestroy$` subject */ protected readonly onDestroy$: Subject; /** * Boolean, If set to true the EditorJS instance gets autofocus when initialized */ autofocus: boolean; /** * Boolean, If set to true the toolbar will not show in the EditorJS instance */ hideToolbar: boolean; /** * String, the ID property of the element that the EditorJS instance will be attached to */ holder: string; /** * String, The type of block to set as the initial block type. This needs to match a name in the `UserPlugins` object. * The default value is "paragraph" */ initialBlock?: string; /** * Number, The minimum height of the EditorJS instance bottom after the last block */ minHeight: number; /** * String, The text to display as the placeholder text in the first block before content is added */ blockPlaceholder: string; /** * SanitizerConfig, The configuration for the HTML sanitizer */ sanitizer: SanitizerConfig; /** * String Array, If empty all tools available via the plugin service will be added. If a string * array is set only the tools with the provided keys will be added */ excludeTools: string[]; /** * Number, Used with Angular Forms this sets an autosave timer active that calls the EditorJS save * method. This patches the `FormControl` value with every block change and focus and blur, it also autosaves after * a set time * Set to 0 to disable or pass a value in `ms` of the autosave time */ autosave: number; /** * Blocks, An initial set of block data to render inside the component */ blocks: Block[]; /** * Emits if the content from the EditorJS instance has been saved to the component value */ hasSaved: EventEmitter; /** * Emits if the component has been touched */ isTouched: EventEmitter; /** * Emits if the component is focused */ isFocused: EventEmitter; /** * Emits if the EditorJS content has changed when `save` is called */ hasChanged: EventEmitter; /** * Emits if the EditorJS component is ready */ isReady: EventEmitter; /** * Form field value if used as a field component */ protected _value: any; /** * Subscription holder for the autosave timer subscription */ protected timerSubscription$: Subscription; /** * Creates an instance of the NgxEditorJSComponent which provides a Angular Forms-compatible component * @param editorService The EditorJS service * @param focusMonitor The Focus Monitor * @param changeDetection The Change Detection Ref */ constructor(editorService: NgxEditorJSService, focusMonitor: FocusMonitor, changeDetection: ChangeDetectorRef); /** * Internal method to return a new timer for the autosave support * @param time Time to do with autosave * @param timeStart When to trigger the first autosave, default is 0 which triggers an immediate save */ protected getTimer(time: number, timeStart?: number): Observable; /** * Angular Form onTouch method, this is a default method that updates * the touch status on the component * @param event The mouse event from the touch */ onTouch(event?: MouseEvent): void; /** * Angular Form onChange method, this is a default method that updates the * editor instance with blocks on change * @param data The data to write */ onChange(data: OutputData): void; /** * Angular Forms value writer, updates the editor * @param data The data to write */ writeValue(data: OutputData): void; /** * Angular Forms registerOnChange */ registerOnChange(fn: (change: OutputData) => void): void; /** * Angular Forms registerOnTouched */ registerOnTouched(fn: (event?: MouseEvent) => void): void; /** * Returns a focus monitor observable with the focus value. * The side effect of this monitor is to update the saved state and * start any autosave timers * @param element The element to monitor * @param checkChildren If the children should be checked */ protected getFocusMonitor(element: HTMLElement, checkChildren?: boolean): Observable; /** * Sets up the service subscriptions to @Output value */ protected setupServiceSubscriptions(): void; /** * Set up the focus monitor and subscriptions to editor service observables */ ngAfterContentInit(): void; /** * Called when the component is destroyed, the focus monitor is destroyed * as well as the editor service, also the onDestroy$ subject is completed */ ngOnDestroy(): void; }