import * as i0 from '@angular/core'; import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, TemplateRef, ElementRef, PipeTransform, InjectionToken, ModuleWithProviders } from '@angular/core'; import * as i1 from '@angular/forms'; import { ControlValueAccessor, FormGroup, AbstractControl, FormControl, ValidatorFn } from '@angular/forms'; import { Schema, ParseOptions, Node } from 'prosemirror-model'; import { Plugin, EditorState } from 'prosemirror-state'; import { EditorView, EditorProps } from 'prosemirror-view'; import { Observable } from 'rxjs'; import { TrustedHTML } from 'trusted-types/lib'; import { SafeHtml } from '@angular/platform-browser'; export { marks, nodes, schema } from '@bobbyquantum/ngx-editor/schema'; interface LinkAttrs { href: string; title?: string; target?: string; } type HeadingLevels = 1 | 2 | 3 | 4 | 5 | 6; interface ImageAttrs { alt?: string; title?: string; width?: string; } type Align = 'left' | 'center' | 'right' | 'justify'; type HTML = string | TrustedHTML; type FocusPosition = 'start' | 'end'; declare class EditorCommands { private view; private state; private tr; constructor(view: EditorView); private applyTrx; private dispatch; exec(): boolean; focus(position?: FocusPosition): this; scrollIntoView(): this; insertText(text: string): this; insertNewLine(): this; applyMark(name: string): this; toggleMark(name: string): this; bold(): this; toggleBold(): this; italics(): this; toggleItalics(): this; underline(): this; toggleUnderline(): this; strike(): this; toggleStrike(): this; code(): this; toggleCode(): this; superscript(): this; subscript(): this; toggleOrderedList(): this; toggleBulletList(): this; toggleHeading(level: HeadingLevels): this; insertLink(text: string, attrs: LinkAttrs): this; updateLink(attrs: LinkAttrs): this; insertImage(src: string, attrs?: ImageAttrs): this; textColor(color: string): this; backgroundColor(color: string): this; removeTextColor(): this; removeBackgroundColor(): this; align(p: Align): this; insertHTML(html: HTML): this; indent(): this; outdent(): this; } type JSONDoc = Record; type Content = HTML | null | JSONDoc; interface Options { content?: Content; history?: boolean; keyboardShortcuts?: boolean; inputRules?: boolean; schema?: Schema; plugins?: Plugin[]; nodeViews?: EditorProps['nodeViews']; attributes?: EditorProps['attributes']; features?: EditorFeatures; handleScrollToSelection?: EditorProps['handleScrollToSelection']; linkValidationPattern?: string; parseOptions?: ParseOptions; } interface EditorFeatures { linkOnPaste?: boolean; resizeImage?: boolean; } declare class Editor { private options; view: EditorView; constructor(options?: Options); private valueChangesSubject; private updateSubject; get valueChanges(): Observable; get update(): Observable; get schema(): Schema; get linkValidationPattern(): string; get commands(): EditorCommands; get features(): EditorFeatures; private handleTransactions; private createEditor; setContent(content: Content): void; registerPlugin(plugin: Plugin): void; destroy(): void; } declare class NgxEditorComponent implements ControlValueAccessor, OnInit, OnChanges, OnDestroy { private renderer; private injector; private elementRef; private cdr; private ngxEditor; editor: Editor; outputFormat: 'doc' | 'html'; placeholder: string; focusOut: EventEmitter; focusIn: EventEmitter; private unsubscribe; private onChange; private onTouched; writeValue(value: Record | HTML | null): void; registerOnChange(fn: () => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; private handleChange; private setMeta; private setPlaceholder; private registerPlugins; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const icons: Record; type IconsKeys = keyof typeof icons; declare const defaults: Record>; type LocalsKeys = keyof typeof defaults; declare class Locals { locals: Record>; constructor(newLocals?: Partial>>); get: (key: string) => Observable; } interface LinkOptions { showOpenInNewTab: boolean; } declare class LinkComponent implements OnInit, OnDestroy { private el; private ngxeService; private menuService; private cdr; options: Partial; showPopup: boolean; isActive: boolean; canExecute: boolean; private componentId; form: FormGroup; private editorView; private updateSubscription; get icon(): HTML; get title(): Observable; get href(): AbstractControl; get text(): AbstractControl; onDocumentClick(e: MouseEvent): void; getId(name: string): string; getLabel(key: string): Observable; private hidePopup; togglePopup(): void; onTogglePopupMouseClick(e: MouseEvent): void; onTogglePopupKeydown(): void; private setText; private update; insertLink(e: MouseEvent): void; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_options: Partial; } type TCR = { dom: HTMLElement; update: (state: EditorState) => void; }; type TBHeadingItems = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; type TBItems = 'bold' | 'italic' | 'code' | 'blockquote' | 'underline' | 'strike' | 'ordered_list' | 'bullet_list' | 'link' | 'image' | 'text_color' | 'background_color' | 'align_left' | 'align_center' | 'align_right' | 'align_justify' | 'horizontal_rule' | 'format_clear' | 'indent' | 'outdent' | 'superscript' | 'subscript' | 'undo' | 'redo'; type ToolbarDropdown = { heading?: TBHeadingItems[]; }; type ToolbarLinkOptions = Partial; type ToolbarLink = { link: ToolbarLinkOptions; }; type ToolbarCustomMenuItem = (editorView: EditorView) => TCR; type ToolbarDropdownGroupKeys = keyof ToolbarDropdown; type ToolbarDropdownGroupValues = ToolbarDropdown[ToolbarDropdownGroupKeys]; type ToolbarItem = TBItems | ToolbarDropdown | ToolbarLink | ToolbarCustomMenuItem; type Toolbar = ToolbarItem[][]; interface NgxEditorConfig { locals?: Partial>>; icons?: Partial>; } declare const DEFAULT_TOOLBAR: Toolbar; declare const TOOLBAR_MINIMAL: Toolbar; declare const TOOLBAR_FULL: Toolbar; declare class NgxEditorMenuComponent implements OnInit { private menuService; toolbar: Toolbar; colorPresets: string[]; disabled: boolean; editor: Editor; customMenuRef: TemplateRef | null; dropdownPlacement: 'top' | 'bottom'; toggleCommands: ToolbarItem[]; insertCommands: ToolbarItem[]; iconContainerClass: string[]; dropdownContainerClass: string[]; seperatorClass: string[]; get presets(): string[][]; trackByIndex(index: number): number; isDropDown(item: ToolbarItem): boolean; getDropdownItems(item: ToolbarItem): ToolbarDropdown; isLinkItem(item: ToolbarItem): boolean; isLinkWithOptions(item: ToolbarItem): boolean; getLinkOptions(item: ToolbarItem): Partial; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NgxEditorFloatingMenuComponent implements OnInit, OnDestroy { el: ElementRef; private cdr; get display(): Partial; private get view(); editor: Editor; autoPlace: boolean; private posLeft; private posTop; private showMenu; private updateSubscription; private dragging; private resizeSubscription; onMouseDown(e: MouseEvent): void; onKeyDown(e: KeyboardEvent): void; onMouseUp(e: MouseEvent): void; onKeyUp(e: KeyboardEvent): void; private useUpdate; private hide; private show; private calculateBubblePosition; private canShowMenu; private update; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class SanitizeHtmlPipe implements PipeTransform { private sanitizer; transform(value: HTML): SafeHtml | TrustedHTML; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } declare class ToggleCommandComponent implements OnInit, OnDestroy { private ngxeService; private menuService; private cdr; toolbarItem: ToolbarItem; get name(): TBItems; html: HTML; editorView: EditorView; isActive: boolean; disabled: boolean; private updateSubscription; toggle(): void; onMouseClick(e: MouseEvent): void; onKeydown(): void; update: (view: EditorView) => void; getTitle(name: string): Observable; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class InsertCommandComponent implements OnInit, OnDestroy { private ngxeService; private menuService; private cdr; toolbarItem: ToolbarItem; get name(): TBItems; html: HTML; editorView: EditorView; disabled: boolean; private updateSubscription; onMouseClick(e: MouseEvent): void; onKeydown(): void; insert(): void; update: (view: EditorView) => void; getTitle(name: string): Observable; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class DropdownComponent implements OnInit, OnDestroy { private ngxeService; private menuService; private el; private cdr; private editorView; private updateSubscription; group: string; items: TBHeadingItems[]; isDropdownOpen: boolean; disabledItems: string[]; activeItem: string | null; get isSelected(): boolean; get isDropdownDisabled(): boolean; onDocumentClick(e: MouseEvent): void; getName(key: string): Observable; getIsDropdownActive(item: string): boolean; toggleDropdown(): void; onToggleDropdownMouseClick(e: MouseEvent): void; onToggleDropdownKeydown(): void; trackByIndex(index: number): number; selectItem(item: TBHeadingItems): void; onDropdownItemMouseClick(e: MouseEvent, item: TBHeadingItems): void; onDropdownItemKeydown(event: Event, item: TBHeadingItems): void; private update; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ImageComponent implements OnInit, OnDestroy { private el; private ngxeService; private menuService; private cdr; showPopup: boolean; isActive: boolean; private componentId; private updateSubscription; form: FormGroup<{ src: FormControl; alt: FormControl; title: FormControl; }>; private editorView; get icon(): HTML; get src(): AbstractControl; onDocumentClick(e: MouseEvent): void; getId(name: string): string; getLabel(key: string): Observable; private hideForm; togglePopup(): void; onTogglePopupMouseClick(e: MouseEvent): void; onTogglePopupKeydown(): void; private fillForm; private update; insertLink(e: MouseEvent): void; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ColorPickerComponent implements OnInit, OnDestroy { private el; private menuService; private ngxeService; private cdr; presets: string[][]; type: string; get title(): Observable; get icon(): HTML; private get command(); private updateSubscription; private editorView; showPopup: boolean; isActive: boolean; activeColors: string[]; canExecute: boolean; getContrastYIQ(hexcolor: string): string; onDocumentClick(e: MouseEvent): void; private hidePopup; togglePopup(): void; onTogglePopupMouseClick(e: MouseEvent): void; onTogglePopupKeydown(): void; remove(): void; onRemoveMouseClick(e: MouseEvent): void; onRemoveKeydown(): void; trackByIndex(index: number): number; selectColor(color: string): void; onColorSelectMouseClick(e: MouseEvent, color: string): void; onColorSelectKeydown(color: string): void; private update; getLabel(key: string): Observable; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BubbleComponent implements OnInit, OnDestroy { private sanitizeHTML; private ngxeService; private cdr; private get view(); editor: Editor; private updateSubscription; execulableItems: TBItems[]; activeItems: TBItems[]; toolbar: TBItems[][]; toggleCommands: TBItems[]; getIcon(name: TBItems): SafeHtml; getTitle(name: string): Observable; trackByIndex(index: number): number; onClick(e: MouseEvent, commandName: TBItems): void; private update; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MenuModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare class ImageViewComponent { src: i0.WritableSignal; alt: i0.WritableSignal; title: i0.WritableSignal; outerWidth: i0.WritableSignal; selected: i0.WritableSignal; view: EditorView; imageResize: EventEmitter; imgEl: i0.Signal>; startResizing(e: MouseEvent, direction: string): void; resizeImage(evt: MouseEvent, direction: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const NGX_EDITOR_CONFIG_TOKEN: InjectionToken; declare class NgxEditorModule { static forRoot(config?: NgxEditorConfig): ModuleWithProviders; static forChild(config?: NgxEditorConfig): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare class NgxEditorServiceConfig { locals: {}; icons: {}; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class NgxEditorService { config: NgxEditorServiceConfig; get locals(): Locals; getIcon(icon: string): HTML; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const provideMyServiceOptions: (config?: NgxEditorConfig) => NgxEditorServiceConfig; declare class Validators { static required(userSchema?: Schema): ValidatorFn; static maxLength(maxLength: number, userSchema?: Schema): ValidatorFn; static minLength(minLength: number, userSchema?: Schema): ValidatorFn; } declare const emptyDoc: { type: string; content: { type: string; }[]; }; declare const toHTML: (json: Record, inputSchema?: Schema) => string; declare const toDoc: (html: HTML, inputSchema?: Schema, options?: ParseOptions) => Record; declare const parseContent: (value: HTML | Record | null, schema: Schema, options?: ParseOptions) => Node; interface ShortcutOptions { history: boolean; } declare const getKeyboardShortcuts: (schema: Schema, options: ShortcutOptions) => Plugin[]; export { DEFAULT_TOOLBAR, Editor, ImageViewComponent, NGX_EDITOR_CONFIG_TOKEN, NgxEditorComponent, NgxEditorFloatingMenuComponent, NgxEditorMenuComponent, NgxEditorModule, NgxEditorService, TOOLBAR_FULL, TOOLBAR_MINIMAL, Validators, emptyDoc, getKeyboardShortcuts, parseContent, provideMyServiceOptions, toDoc, toHTML }; export type { NgxEditorConfig, TBHeadingItems, TBItems, Toolbar, ToolbarCustomMenuItem, ToolbarDropdown, ToolbarDropdownGroupKeys, ToolbarDropdownGroupValues, ToolbarItem, ToolbarLink, ToolbarLinkOptions };