import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; import EditorJS, { EditorConfig, OutputData, SanitizerConfig } from '@editorjs/editorjs'; import { Observable } from 'rxjs'; import { NgxEditorJSService } from '../services/editorjs.service'; import { Block } from '../types/blocks'; /** * The main directive of `ngx-editorjs` provides a way to attach * an EditorJS instance to any element and control it via * Angular services and components * * To use attach to any element with an `id` property * * @example *
*/ export declare class NgxEditorJSDirective implements OnDestroy, OnChanges, AfterContentInit { protected readonly el: ElementRef; protected readonly editorService: NgxEditorJSService; protected readonly cd: ChangeDetectorRef; /** * On Destroyed subject */ private readonly onDestroy$; /** * Form touched state */ private touched$; /** * The DOM element ID, it will use the Directive DOM element ID or falls back to the provided `holder` property */ private id; /** * 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; /** * Host click listener */ onclick(): void; /** * Creates the directive instance * @param el The element the directive is attached to * @param editorService The editor service */ constructor(el: ElementRef, editorService: NgxEditorJSService, cd: ChangeDetectorRef); /** * Get the EditorJS instance for this directive */ get editor(): Observable; /** * Get the element for the directive */ get element(): any; /** * Get the `NgxEditorJSService` for this directive */ get service(): NgxEditorJSService; /** * Get the touched state */ get touched(): Observable; /** * Creates an EditorJS instance for this directive * @param config Configuration for this instance * @param excludeTools */ createEditor(config?: EditorConfig, excludeTools?: any[]): Promise; /** * When ngOnChanges are called, there are two paths * If it's just blocks, then the service is updated with the blocks * If it's any other property it means we create a new editor, as this * is a destructive process we also need to wait for an existing editor * to be ready * @param changes Changes on the component */ ngOnChanges(changes: SimpleChanges): Promise; /** * After content is created, we create the editor instance and set up listners */ ngAfterContentInit(): Promise; /** * Destroy the editor and subjects for this service */ ngOnDestroy(): void; /** * Create a configuration for EditorJS */ private createConfig; }