ngx-dynamic-hooks
Version:
Automatically insert live Angular components into a dynamic string of content (based on their selector or any pattern of your choice) and render the result in the DOM.
47 lines (46 loc) • 1.67 kB
TypeScript
import { HookIndex } from '../../interfacesPublic';
import { AutoPlatformService } from '../platform/autoPlatformService';
import * as i0 from "@angular/core";
/**
* A utility service that sanitizes an Element and all of its children while exluding found hook elements
*/
export declare class ContentSanitizer {
private platformService;
attrWhitelist: string[];
constructor(platformService: AutoPlatformService);
/**
* Sanitizes an element while preserving marked hook anchors
*
* @param contentElement - The element to sanitize
* @param hookIndex - The current hookIndex
* @param token - The current ParseToken
*/
sanitize(contentElement: any, hookIndex: HookIndex, token: string): any;
/**
* Sanitizes a single element's attributes
*
* @param element - The element in question
*/
private sanitizeElementAttrs;
/**
* Finds and encodes all tags that match the specified regex so that they survive sanitization
*
* @param content - The stringified html content to search
* @param substrRegex - The regex that matches the element tags
*/
private findAndEncodeTags;
/**
* Encodes the special html chars in a html tag so that is is considered a harmless string
*
* @param element - The element as a string
*/
private encodeTagString;
/**
* Decodes the encoded html chars in a html tag again
*
* @param element - The element as a string
*/
private decodeTagString;
static ɵfac: i0.ɵɵFactoryDeclaration<ContentSanitizer, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ContentSanitizer>;
}