nowjs-core
Version:
NowCanDo Javascript Core [nowjs-core] is a library written by TypeScript code maintains under Apache 2.0 licence
36 lines (35 loc) • 1.11 kB
TypeScript
import { SanitizerBase } from '../index';
export interface IAllowedHtmlAttribute {
[key: string]: string[];
}
export interface IAllowedHtmlClass {
[key: string]: string[];
}
export interface ITransformHtmlTag {
[key: string]: ((item: string, attribs?: any) => string) | string;
}
export interface IFilterHtmlTag {
[key: string]: (item: string, attribs?: any) => boolean;
}
export interface IHtmlSanitizerOptions {
AllowedTags?: string[];
AllowedAttributes?: IAllowedHtmlAttribute;
AllowedClasses?: IAllowedHtmlClass[];
AllowedSchemes?: string[];
SelfClosingTags?: string[];
TransformTags?: ITransformHtmlTag;
FilterTags?: IFilterHtmlTag | string[];
}
export declare class HtmlSanitizer extends SanitizerBase<IHtmlSanitizerOptions> {
private options?;
private tagRegex;
private tagAttrRegex;
constructor(options?: IHtmlSanitizerOptions);
sanitize(value: string): Promise<string>;
private sanitizeInnerText;
private hasTag;
private sanitizeTagAttributes;
private getTagAttributeParts;
private getTagParts;
private escapeHtml;
}