mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-10 09:40:21 +08:00
Updated sanitize-html type definitions for version 1.18.2 (#27676)
* Updated sanitize-html type definitions for version 1.18.2 * Augemented sanitize-html test file
This commit is contained in:
6
types/sanitize-html/index.d.ts
vendored
6
types/sanitize-html/index.d.ts
vendored
@@ -1,8 +1,9 @@
|
||||
// Type definitions for sanitize-html 1.14.1
|
||||
// Type definitions for sanitize-html 1.18.2
|
||||
// Project: https://github.com/punkave/sanitize-html
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Afshin Darian <https://github.com/afshin>
|
||||
// BehindTheMath <https://github.com/BehindTheMath>
|
||||
// Rinze de Laat <https://github.com/biermeester>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = sanitize;
|
||||
@@ -38,9 +39,12 @@ declare namespace sanitize {
|
||||
|
||||
interface IOptions {
|
||||
allowedAttributes?: { [index: string]: string[] } | boolean;
|
||||
allowedStyles?: { [index: string]: { [index: string]: RegExp[] } };
|
||||
allowedClasses?: { [index: string]: string[] } | boolean;
|
||||
allowedIframeHostnames?: string[];
|
||||
allowedSchemes?: string[] | boolean;
|
||||
allowedSchemesByTag?: { [index: string]: string[] } | boolean;
|
||||
allowedSchemesAppliedToAttributes?: string[];
|
||||
allowProtocolRelative?: boolean;
|
||||
allowedTags?: string[] | boolean;
|
||||
exclusiveFilter?: (frame: IFrame) => boolean;
|
||||
|
||||
@@ -4,8 +4,17 @@ let options: sanitize.IOptions = {
|
||||
allowedTags: sanitize.defaults.allowedTags.concat('h1', 'h2', 'img'),
|
||||
allowedAttributes: {
|
||||
'a': sanitize.defaults.allowedAttributes['a'].concat('rel'),
|
||||
'img': ['src', 'height', 'width', 'alt']
|
||||
'img': ['src', 'height', 'width', 'alt', 'style']
|
||||
},
|
||||
allowedStyles: {
|
||||
'*': {
|
||||
color: [/^red$/],
|
||||
background: [/^green$/],
|
||||
'background-color': [/^#0000FF$/]
|
||||
}
|
||||
},
|
||||
allowedIframeHostnames: ['www.youtube.com'],
|
||||
allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],
|
||||
transformTags: {
|
||||
'a': sanitize.simpleTransform('a', { 'rel': 'nofollow' }),
|
||||
'img': (tagName: string, attribs: sanitize.Attributes) => {
|
||||
|
||||
Reference in New Issue
Block a user