editor.js/types/configs/sanitizer-config.d.ts
Hiếu Phan 51b1fdc9e0
Hotfix: sanitizer config type definition (#1491)
* fix: sanitizer config type definition

* update func parram in sanitizer config

* update type

* Update CHANGELOG.md

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2021-02-18 18:47:11 +03:00

36 lines
943 B
TypeScript

export interface SanitizerConfig {
/**
* Tag name and params not to be stripped off
* @see {@link https://github.com/guardian/html-janitor}
*
* @example Save P tags
* p: true
*
* @example Save A tags and do not strip HREF attribute
* a: {
* href: true
* }
*
* @example Save A tags with TARGET="_blank" attribute
* a: function (aTag) {
* return aTag.target === '_black';
* }
*
* @example Save U tags that are not empty
* u: function(el){
* return el.textContent !== '';
* }
*
* @example For blockquote with class 'indent' save CLASS and STYLE attributes
* Otherwise strip all attributes
* blockquote: function(el) {
* if (el.classList.contains('indent')) {
* return { 'class': true, 'style': true };
* } else {
* return {};
* }
* }
*/
[key: string]: boolean|{[attr: string]: boolean|string}|((el?: Element) => any);
}