UNPKG

ngx-linkifyjs-v2

Version:

Angular wrapper for linkifyjs - library for finding links in plain text and converting them to HTML <a> tags via linkifyjs

81 lines (74 loc) 2.66 kB
import * as i0 from '@angular/core'; import { PipeTransform, InjectionToken, ModuleWithProviders } from '@angular/core'; import * as i2 from '@angular/common'; declare enum LinkType { URL = "url", HASHTAG = "hashtag", MENTION = "mention", EMAIL = "email" } interface Link { type: string; value: string; href: string; } interface NgxLinkifyjsConfig { enableHash?: boolean; enableMention?: boolean; } interface NgxLinkifyOptions { attributes?: any; className?: string; defaultProtocol?: string; events?: any; ignoreTags?: Array<any>; nl2br?: boolean; tagName?: string; target?: { url: string; }; validate?: boolean; format?(value: any, type: any): any; formatHref?(href: any, type: any): any; } declare class NgxLinkifyjsPipe implements PipeTransform { transform(value: string, options?: NgxLinkifyOptions): string; static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<NgxLinkifyjsPipe, "linkify", false>; } declare class NgxLinkifyjsService { constructor(); /** * Convert the passed text as a string to an appropriate url * * @param text - the string to convert * @param options - options to pass it to the linkifyjs library */ linkify(text: string, options?: NgxLinkifyOptions): string; /** * Find any links in a given text as a string * * @param text - the string to find some links */ find(text: string): Array<Link>; /** * Test if a given value is a link or an array of all links * * @param value - the value to test */ test(value: string | string[]): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NgxLinkifyjsService>; } declare const NgxLinkifyjsConfigToken: InjectionToken<NgxLinkifyjsConfig>; declare const DEFAULT_CONFIG: NgxLinkifyjsConfig; declare class NgxLinkifyjsModule { config: NgxLinkifyjsConfig; static forRoot(config?: NgxLinkifyjsConfig): ModuleWithProviders<NgxLinkifyjsModule>; constructor(config: NgxLinkifyjsConfig); static ɵfac: i0.ɵɵFactoryDeclaration<NgxLinkifyjsModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NgxLinkifyjsModule, [typeof NgxLinkifyjsPipe], [typeof i2.CommonModule], [typeof NgxLinkifyjsPipe]>; static ɵinj: i0.ɵɵInjectorDeclaration<NgxLinkifyjsModule>; } export { DEFAULT_CONFIG, LinkType, NgxLinkifyjsConfigToken, NgxLinkifyjsModule, NgxLinkifyjsPipe, NgxLinkifyjsService }; export type { Link, NgxLinkifyOptions, NgxLinkifyjsConfig };