UNPKG

ngx-tiptap-editor

Version:

[![Build and Publish](https://github.com/HuiiBuh/ngx-tiptap-editor/actions/workflows/publish.yml/badge.svg)](https://github.com/HuiiBuh/ngx-tiptap-editor/actions/workflows/publish.yml) [![Deploy to Github Pages](https://github.com/HuiiBuh/ngx-tiptap-edito

40 lines (39 loc) 1.89 kB
import { ComponentRef, Injector, StaticProvider, Type } from '@angular/core'; import { AnyExtension, Editor } from '@tiptap/core'; import { Subject } from 'rxjs'; import { C, ObjectProp } from '../models/utility-types'; import { Constructor, ExtensionBuilder } from './base-extension.model'; export interface TipBaseExtension<T> { defaultOptions: Partial<T>; onEditorReady(): void | Promise<void>; onEditorDestroy(): void | Promise<void>; } export declare abstract class TipBaseExtension<T extends object> { protected destroy$: Subject<boolean>; private _nativeExtension; private _options; private _editor; static create<EXTENSION extends Constructor, OPTIONS extends Partial<ObjectProp<C.Instance<EXTENSION>, 'options'>>>(extension: EXTENSION, extensionOptions: OPTIONS): ExtensionBuilder<OPTIONS, EXTENSION>; abstract createExtension(extensionOptions: Required<T>): AnyExtension; set options(value: T); get options(): T; set editor(value: Editor); get editor(): Editor; set nativeExtension(value: AnyExtension); get nativeExtension(): AnyExtension; } export declare abstract class AdvancedBaseExtension<T extends object> extends TipBaseExtension<T> { protected abstract injector: Injector; /** * Inject the provided component at any position in the dom * @param component The component which should be injected * @param injectionPoint The point you want to inject the component into (this.document.body for example) */ protected createAndInsertIntoDom<COMP>(component: Type<COMP>, injectionPoint: HTMLElement): { remove: () => void; }; protected insertComponent(componentRef: ComponentRef<any>, injectionPoint: HTMLElement): { remove: () => void; }; protected createComponent<COMP>(component: Type<COMP>, additionalProviders?: StaticProvider[]): ComponentRef<COMP>; }