Update definitions of sanitize-html from 1.18.2 to 1.20.1 (#35873)

This commit is contained in:
Jianrong Yu 2019-06-03 16:30:10 -07:00 committed by Andrew Casey
parent 558f693059
commit 2605bf19cb
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for sanitize-html 1.18.2
// Type definitions for sanitize-html 1.20.1
// Project: https://github.com/punkave/sanitize-html
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Afshin Darian <https://github.com/afshin>
@ -7,6 +7,7 @@
// Will Gibson <https://github.com/WillGibson>
// A penguin <https://github.com/sirMerr>
// Johan Davidsson <https://github.com/johandavidson>
// Jianrong Yu <https://github.com/YuJianrong>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import {Options} from "htmlparser2";
@ -47,11 +48,13 @@ declare namespace sanitize {
allowedStyles?: { [index: string]: { [index: string]: RegExp[] } };
allowedClasses?: { [index: string]: string[] } | boolean;
allowedIframeHostnames?: string[];
allowIframeRelativeUrls?: boolean;
allowedSchemes?: string[] | boolean;
allowedSchemesByTag?: { [index: string]: string[] } | boolean;
allowedSchemesAppliedToAttributes?: string[];
allowProtocolRelative?: boolean;
allowedTags?: string[] | boolean;
textFilter?: (text: string) => string;
exclusiveFilter?: (frame: IFrame) => boolean;
nonTextTags?: string[];
selfClosing?: string[];

View File

@ -23,6 +23,8 @@ let options: sanitize.IOptions = {
return img;
}
},
textFilter: text => text,
allowIframeRelativeUrls: false,
exclusiveFilter: function(frame: sanitize.IFrame) {
return frame.tag === 'a' && !frame.text.trim();
},