editor.js/src/components/modules/api/sanitizer.ts
Peter Savchenko 3272efc3f7
chore(linting): eslint updated, code linted (#2174)
* update eslint + autofix

* a bunch of eslint fixes

* some spelling & eslint fixes

* fix some eslint errors and spells

* Update __module.ts

* a bunch of eslint fixes in tests

* Update cypress.yml

* Update cypress.yml

* fix cypress docker image name

* fixes for tests

* more tests fixed

* rm rule ignore

* rm another ignored rule

* Update .eslintrc
2022-11-25 21:56:50 +04:00

33 lines
881 B
TypeScript

import { Sanitizer as ISanitizer } from '../../../../types/api';
import { SanitizerConfig } from '../../../../types/configs';
import Module from '../../__module';
import { clean } from '../../utils/sanitizer';
/**
* @class SanitizerAPI
* Provides Editor.js Sanitizer that allows developers to clean their HTML
*/
export default class SanitizerAPI extends Module {
/**
* Available methods
*
* @returns {SanitizerConfig}
*/
public get methods(): ISanitizer {
return {
clean: (taintString, config): string => this.clean(taintString, config),
};
}
/**
* Perform sanitizing of a string
*
* @param {string} taintString - what to sanitize
* @param {SanitizerConfig} config - sanitizer config
* @returns {string}
*/
public clean(taintString: string, config: SanitizerConfig): string {
return clean(taintString, config);
}
}