mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 10:50:23 +02:00
51b1fdc9e0
* 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>
36 lines
943 B
TypeScript
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);
|
|
}
|